[hibernate-dev] [OGM] Id generation strategies

Gunnar Morling gunnar at hibernate.org
Wed Jun 4 09:36:45 EDT 2014


Hi,

I'm rather confused by the way how OgmIdentityGenerator,
OgmSequenceGenerator and OgmTableGenerator interact.

Basically, the first two just delegate to the latter. Now intuitively I'd
have expected an exception when explicitly using a generation type not
supported on a given datastore, say @GeneratedValue(strategy =
GenerationType.SEQUENCE) on MongoDB. But as we always delegate to the table
strategy, such exception is not raised.

Also several attributes of generator annotations are ignored; E.g.
naturally at SequenceGenerator.sequenceName(), but also
@TableGenerator.valueColumnName.

What has been the motivation behind this design?

I guess a change to GridDialect may be required for making explicit which
strategies are supported on a given backend.

Thanks,

--Gunnar


More information about the hibernate-dev mailing list