openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <da...@6degrees.com>
Subject SingleFieldManager.preFlushPC
Date Fri, 28 Aug 2009 12:15:23 GMT
Hello,

I've tried unsuccessfully to get help from the users' list. Hopefully
someone here can shed some light.

I'm getting this error:

org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged
object in persistent field "blah.model.MyEntity.anotherEntity" during flush.
 However, this field does not allow cascade persist. Set the cascade
attribute for this field to CascadeType.PERSIST or CascadeType.ALL (JPA
annotations) or "persist" or "all" (JPA orm.xml), or enable cascade-persist
globally, or manually persist the related field value prior to flushing. You
cannot flush unmanaged objects or graphs that have persistent associations
to unmanaged objects.
FailedObject: blah.model.AnotherEntity-1981
       at
org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(SingleFieldManager.java:754)
       at
org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:594)

SingleFieldManager.preFlushPC looks like this, with the last line throwing
my exception:

        OpenJPAStateManager sm;


        *if* (vmd.getCascadePersist() == ValueMetaData.*CASCADE_NONE*) {

            *if* (!_broker.isDetachedNew() && _broker.isDetached(obj))

                *return*; // allow but ignore


            sm = _broker.getStateManager(obj);

            *if* (sm == *null* || !sm.isPersistent())

                *throw* *new* InvalidStateException(

                    *_loc*.get("cant-cascade-persist", vmd))

                    .setFailedObject(obj);


I can't reproduce the problem, so I don't know if sm is null or sm is not
persistent. I have 2 questions that are maybe the same: what condition leads
to sm being null or not persistent and what exactly is an "unmanaged"
object?

Thanks.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message