First off, you're using openjpa.RuntimeUnenhancedClasses=supported which is
not recommended. You'll be much, much happier if you spend the time to set
up another enhancement[1] method (build time / javaagent).

.... and on to your real question, I think you should be looking at options
A or C and ignore option D.

Thanks,
Rick


[1] http://openjpa.apache.org/entity-enhancement.html


On Tue, Feb 12, 2013 at 8:14 AM, Alex <fiie...@gmail.com> wrote:

> Hi all,
>
> I got a below error,
>
> Caused by: <openjpa-2.2.1-r422266:1396819 nonfatal user error>
> org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged
> object "org.apache.openjpa.enhance.MEmployee$pcsubclass-670" in life cycle
> state  unmanaged while cascading persistence via field "MEmployee" 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().
>
> About option D, would someone advise me how to get reference of
> StoreContext or it's implementation?
>
> Thanks in advance.
>
>
>
> Alex




-- 
*Rick Curtis*

Reply via email to