[hibernate-dev] Question about substituting IDs in Hibernate OGM

Gunnar Morling gunnar at hibernate.org
Wed Feb 11 03:42:33 EST 2015

Hi Josiah,

It's great to hear that you are working an a backend for Hibernate OGM!

Regarding ids, it should work for you if they are mapped using the IDENTITY

    Long id;

This causes the Hibernate ORM engine to read back the id value generated by
the datastore upon insertion. To make it work, your GridDialect for OGM
needs to implement the IdentityColumnAwareGridDialect facet [1]. You can
check out the MongoDB dialect for an example.

If this works and this kind of id generation is the only one which is
useful for Datomic (i.e. table/sequence strategies don't make any sense),
you may validate mapped entities by means of a SchemaDefiner [2] (an
experimental contract of OGM). An example is CouchDBSchemaDefiner.

Let us know how it goes or in case you run into any other issues.



2015-02-11 2:40 GMT+01:00 Haswell, Josiah D <Josiah.Haswell at ca.com>:

> Hi folks,
> I'm creating a Hibernate OGM implementation for Datomic, and I have a
> question about IDs.
> Say I have the entity
> @Entity
> public class Person {
> @Id
> @GeneratedValue
> Long id;
> }
> In Datomic, you have to assign a temporary ID before submitting the
> transaction.  Datomic will then return the actual persistence ID after the
> transaction has completed.  My question is, how can I get the actual ID
> back into the entity?
> Thanks!
> Josiah
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list