openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Re: How to get the reference of StoreContext
Date Tue, 12 Feb 2013 15:07:57 GMT
> I just want to know how to implement option D...
Can I have you describe your scenario a little bit better? I trying to
avoid allowing you to go down a path that isn't quite optimal... and I'm
struggling to come up with a use case for
setAllowReferenceToSiblingContext. From
what I can tell, you're flushing a context and one of your Entities has a
relationship to another Entity that wasn't persisted. If that is the case,
do you not want the non-persisted Entity to go to the database?

Thanks,
Rick




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

> **
> Rick,
>
> Thanks for your reply.
>
> I will enhance the entities later. I just want to know how to implement
> option D...
>
> ------------------------------
> Alex
>
>  *From:* Rick Curtis <curtisr7@gmail.com>
> *Date:* 2013-02-12 22:25
> *To:* users <users@openjpa.apache.org>; fiiexbl <fiiexbl@gmail.com>
> *Subject:* Re: How to get the reference of StoreContext
>  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 <fiiexbl@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*
>



-- 
*Rick Curtis*

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