-----Original Message-----
From: Daryl Stultz [mailto:daryl@6degrees.com]
Sent: Thursday, 17 September 2009 3:08 AM
To: users@openjpa.apache.org
Subject: Re: SingleFieldManager crash
On Wed, Sep 16, 2009 at 2:48 PM, C N Davies <cnd@cndavies.com> wrote:
>
> The main object is new, but the attached entities are not new, the members
> are populated by retrieving existing entities use em.find.
>
> That is similar to my case, though usually the existing entities are from
a
query. I'm wondering why there is no primary key after the hash for
Supplier, I always get it.
Not sure about this one, I don't usually see the primary key after the hash,
I'm using the runtime subclassing enhancement so maybe there is a difference
there.
> If I set cascade type to PERSIST I get a different error but basically
> complaining about the same thing:
>
> What about CascadeType.ALL?
Same issue.
> (JPA orm.xml). You cannot attach a reference to a new object without
> cascading.
>
>I don't understand this statement at all and contend it's not true. I
>totally do that all the time. That's why I'm so perplexed. I can even do
>this:
>A a = new A();
>B b = new B();
>b.setId(12);
>a.setB(b);
>em.persist(a);
>and it works (provided B with ID of 12 exists in the database).
Yes I agree, sometimes it works and sometimes it doesn't. I just happen to
have one particular case whereby it always fails. I'm trying to debug the
SingleFieldManager now to see if I can see what is happening.
In the past I had this behaviour if I was using queries retrieve the
attached entities because I was using a second instance of the entity
manager. Once I fixed that code the issue went away, however I still have
this class that will always fail.
Chris
|