openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <da...@6degrees.com>
Subject Re: SingleFieldManager.preFlushPC
Date Wed, 09 Sep 2009 12:23:56 GMT
On Fri, Sep 4, 2009 at 8:59 AM, Daryl Stultz <daryl@6degrees.com> wrote:

Can I get someone to comment on this?


> Does this look like it should work or fail:
>
> EntityManager em = getEntityManager();
> A a = em.find(A.class, 1);
> em.close();
> em = getEntityManager();
> B b = em.find(B.class, 2);
> em.close();
> em = getEntityManager();
> a.setB(b); // presuming this is a different B value than before
> em.merge(a);
>
> The property "b" on "a" is not set to Cascade. How about this:
>
> EntityManager em = getEntityManager();
> B b = em.find(B.class, 2);
> em.close();
> em = getEntityManager();
> A a = new A();
> a.setB(b);
> em.persist(a);
>
> This is the general idea to what I'm doing, though the object graph is a
> bit more complicated. I'm still trying to understand what state "b" is
> expected to be in if I'm not using CascadeType.PERSIST/MERGE.
>
> 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