Subject Re: andromda+hibernate
Author Roman Rokytskyy
> I use andromda to generate persistence descriptors (.hbm files)
> from UML diagrams that are fed to hibernate to implement
> the persistence ayer in my application.
> what's strange is that the process generates ddl files
> containig DD statements looking like this:
>
> create table HIB_REMOVED_BARCODE (ID VARCHAR(255) not null, class
> VARCHAR(255) not null, CODE VARCHAR(255), TYPE INTEGER(9), primary
> key (ID))
>
> AFAIK, TYPE is a reserverd keyword for FB, and as a matter of fact
> FB throws the error:
>
> Unsuccessful: GDS Exception. 335544569. Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 1, char 109
> TYPE
>
> if I try to issue the statement (in this case
> I can change that class' member name: hussle, nut no more).

You can simply quote column name TYPE -> "TYPE" and Firebird will eat
it without any problems. However, it might cause problems later.

> What's worst is the "primary key (ID)" statement:
> id is 255 chars long
> and FB does not support so long primary keys!
>
> Any hint?

That's Firebird's limitation for index key size. You have to change
your PK to either surrogate PK or build a hash (for example using MD5)
and use it as PK. As far as I remember Hibernate supports sequences
with Firebird and introducing surrogate key should not be a problem.

Roman