Hi folks,
In Datomic, when you create an entity, you must give the entity a temporary ID before you
insert it. After the transaction completes, each entity in the transaction is given an
actual persistence ID back from the database. My initial approach was to generate the
temporary identifier in the createTuple method of the IdentityColumnAwareGridDialect, and
provide a customer persister implementation to handle it. It occurred to me that it might
be easier to just use a listener. After a bit of fiddling around, I discovered that
PostCommitInsertEventListener can (apparently) substitute out the ID at what appears to be
the correct location. From what I can tell, this both simplifies the code, and the
generated ID seems to be propagated to everything correctly. Is the custom persister the
preferred way to do this? Or should this work? Is there a better place to perform that
substitution?
Thanks!
Josiah
Show replies by date