openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dinkar Rao" <>
Subject Re: Generated primary key values are available in the PostPersist method ?
Date Mon, 12 Jan 2009 04:16:50 GMT

The PostPersist method does have access to the generated id value. But
the id value is generated when a new record is inserted into the
table. It is not guaranteed that the PostPersist method will be called
immediately after an em.persist() call. The spec says,

"The PostPersist and PostRemove methods will be invoked after the
database insert and delete operations respectively."

These insert and delete operations may themselves happen only at
em.flush() or em.commit() time. At that time, the id value is
generated and the PostPersist method is called.


View raw message