Woe is me :)

I'm using @PostPersist to create some kind of machine-generated data for entities on insert, and I'm running into the following problem when an entity for which I called persist() has in it a new, unmanaged entity.

[junit-coverage] Caused by: <openjpa-1.0.0-r420667:568756 fatal user error> org.apache.openjpa.util.InvalidStateException: Detected reentrant flush. Make sure your flush-time instance callback methods or event listeners do not invoke any operations that require the in- progress flush to complete. [junit-coverage] at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1840) [junit-coverage] at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1615) [junit-coverage] at org .apache .openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java: 505) [junit-coverage] at org .apache .openjpa.kernel.StateManagerImpl.assignField(StateManagerImpl.java:590) [junit-coverage] at org .apache .openjpa .kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1451) [junit-coverage] at org .apache .openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java: 1434) [junit-coverage] at com.joost.model.InventoryItem.getId(InventoryItem.java) [junit-coverage] at com.joost.model.InventoryItem.initPublicIdIfNull(InventoryItem.java:331)


in InventoryItem, getId is the PK, and my read of the spec says that I am guaranteed to have it in @PostPersist.

Bug?  me doing something wrong?

geir

Reply via email to