On Nov 15, 2007, at 4:34 PM, Pinaki Poddar wrote:

persist() has in it a new, unmanaged entity.

a) If persist(a) is failing on b, what is the cascade type specified on
relation a.b?

I'm not actually sure that it's failing on b. I guess I can try to figure that out. I just know that when I change things so that I have an unmanaged b, it fails.


b) what is the identity definition on b?
c) if b is using auto-assigned GeneratedValue or its id is being set by
application?

-----Original Message-----
From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 15, 2007 11:10 AM
To: [email protected]
Subject: @PostPersist woes

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


Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Reply via email to