Hi,

I am trying to persist an entity into the database. That entity has a field
associated with another entity. Both these entities belong to different
persistence units. When trying to persist the entity I get the below error.

> Invalid parameter - Encountered unmanaged object
"com.ibm.powersc.ts.policies.vlan.persistence.VLANPolicy@40004000" in life
cycle state  unmanaged while cascading persistence via field
"com.ibm.sc.core.persistence.Zone.policies<element:class
com.ibm.sc.core.persistence.Policy>" during flush.  However, this field
does not allow cascade persist. You cannot flush unmanaged objects or
graphs that have persistent associations to unmanaged objects.
 Suggested actions: a) Set the cascade attribute for this field to
CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or "persist" or
"all" (JPA orm.xml),
 b) enable cascade-persist globally,
 c) manually persist the related field value prior to flushing.
 d) if the reference belongs to another context, allow reference to it by
setting StoreContext.setAllowReferenceToSiblingContext().


I tried to give cascade.All option to the field having entity reference,
then I get an error message "This entity is not managed by this context".

Regards,
Akash

Reply via email to