I am using openJPA 1.0.1 inside Websphere 6.1.0. I have written a Entity listener that is trying to publish a copy of the object onto a JMS message. This involves serializing a copy of the object to put it on the JMS message.
I ran into an issue where the serialization of the object causes a reentrant flush. I was wondering if there is an easy way to make a copy of the object such that it can be serialized without impacting the current transaction. Here is the error message I get: R <openjpa-1.0.1-r420667:592145 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. SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:210 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1848) SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:210 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1623) SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:210 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.DetachManager.flushDirty(DetachManager.java:22 3) SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:216 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1977) SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:216 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1852) SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:216 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1623) SystemErr_08.03.26_12.05.05.log:[3/25/08 9:03:55:216 GMT-05:00] 00000030 SystemErr R at org.apache.openjpa.kernel.DetachManager.flushDirty(DetachManager.java:22 3)