[hibernate-dev] [OGM] Behavior of GenerationType.IDENTITY with OGM

Gunnar Morling gunnar at hibernate.org
Mon Jan 20 06:23:05 EST 2014


Hi,

While reviewing the PR for batch operations in OGM [1], I took some time to
better understand OGM's approaches for id generation.

Now I'm wondering about how GenerationType.IDENTITY is implemented. The
corresponding generator (OgmIdentityGenerator) just delegates to a
table-based strategy, so an id is always pre-allocated and then passed into
the dialect when creating a tuple.

I think it would be nice to have proper support for server-generated ids,
in particular since some stores return the inserted id directly from the
insert operation, i.e. without requiring another read.

For the time being, as the current implementation doesn't really adhere to
the semantics of GenerationType.IDENTITY, should we raise an error when
using it instead of silently using another strategy?

Thoughts?

--Gunnar

[1] https://hibernate.atlassian.net/browse/OGM-175


More information about the hibernate-dev mailing list