org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged object in persistent field "...model.Foo" 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: ...model.Foo-8729

openjpa-users | Daryl Stultz | 7 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    PC object losing state

    openjpa-users | 7 years ago | Daryl Stultz
    org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged object in persistent field "...model.Foo" 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: ...model.Foo-8729

    Root Cause Analysis

    1. org.apache.openjpa.persistence.InvalidStateException

      Encountered unmanaged object in persistent field "...model.Foo" 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: ...model.Foo-8729

      at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC()
    2. OpenJPA Aggregate Jar
      StateManagerImpl.beforeFlush
      1. org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(SingleFieldManager.java:754)
      2. org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:594)
      3. org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:562)
      4. org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:478)
      5. org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2829)
      6. org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
      7. org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:960)
      7 frames