← Back to team overview

dhis2-devs team mailing list archive

Re: dhis lite

 

I am not sure if I understand all of this correctly but it seems that
if we use (as we do):
 <generator class="native"/>

then hibernate will delegate to 'identity' for h2 and mysql (and
probably 'sequence' for postgres).  Derby for some peculiar reason
delegates to 'hilo'.

Presumably we could fix this by making generator class="identity" but
that then maybe breaks postgres which is not an option.  Or do we have
to patch the dialect?  again.

I haven't really got my head around "hilo" but it looks like a pain.

Any thoughts?

Bob

2009/4/6 Lars Helge Øverland <larshelge@xxxxxxxxx>:
>
>>
>> That's good news.  BTW I forgot to attach the patch.  I think there's
>> still a few things to do around the jdbc module for derby, but that
>> looks like mostly cut and paste stuff (unless my sources are not quite
>> up to date).  Otherwise I think we're nearly there ...
>
>
> Things now run fine with derby regarding normal Hibernate operations.
>
> For the "jdbc component" I struggle with generating identifiers for primary
> keys in SQL insert statements. The standard way to create such an
> auto-incremented field would be to add "not null generated always as
> identity" to the column list. This would allow you to simply skip this field
> in the column/values part in the sql insert statement and let derby generate
> the identifier.
>
> It looks as if Hibernate create tables without this auto-increment feature.
> When I run the ij tool and describe tables, the id column has column_def =
> "NULL", while tables I create manually with auto-increment id get column_def
> = "AUTOINCREMENT". Also, running sql statements with the identifier column
> left out gives me an error saying that the id column cannot accept a null
> value.
>
> Is Hibernate using its hi-lo id generator? It it using some sort of
> sequence, like Postgres? I would hate implementing my own id generator for
> this.
>
>
>



Follow ups

References