openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <...@cndavies.com>
Subject RE: SingleFieldManager crash
Date Wed, 16 Sep 2009 21:11:46 GMT
Hi Daryl,

It's been driving me nuts for a long time so thought it'd be worth
understanding the issue since you are having it as well. One other thing I
am not sure if you have checked or not (sorry if I missed it), I can get a
similar issue if I have an entity in the attached field that for whatever
reason has broken references to other entities. Since I am generally using
REFRESH when attaching entities, when I persist/merge an entity, it
basically walks down the entity relationships and is checking all the linked
entities, not just the ones I am linking immediately. What I found before
was that if one of those references was pointing to an entity that longer
existed in the DB, the "detached" issue would effect the top level entity's
ability to persist. 

Hard to explain, maybe I can draw it here:

Company -> officeLocation -> Address -> Country

Each of these are entities.

If I go to persist/merge Company, officeLocation is refreshed which causes
Address to refresh, which causes Country to refresh. If for example Country
is no longer in the DB (it was attached to the address when it was in the
DB), then attempting to save Company fails with a detached error.

I also noticed that if I attach a null entity to my main entity, this null
entity ends up being non-null inside the OpenJPA code (haven't worked out
how or where yet) and is assigned an id, however the persist/merge will fail
whether or not the DB allows a null in that column.

Just a few little anomalies I see :) 

Regarding the Ant script, I am using eclipse and exported my project out to
an ANT build file, I can hack that into shape if you can send me your
enhancement step I am happy to stick it in and give it a shot.
 
Chris

-----Original Message-----
From: Daryl Stultz [mailto:daryl@6degrees.com] 
Sent: Thursday, 17 September 2009 4:50 AM
To: users@openjpa.apache.org
Subject: Re: SingleFieldManager crash

On Wed, Sep 16, 2009 at 4:32 PM, C N Davies <cnd@cndavies.com> wrote:

> but in the case of the "supplier" entity
> you saw in my stack trace, sm is returning null and hence throwing the
> InvalidStateException.

...

> So somewhere in the _broker.getStateManager() the wheels are falling
> off.  I'll dig deeper.
>
> That's my suspicion with my case but since I can't step through it, I
can't
be sure.

Chris, you've been the only person to put forth serious effort to help me
with this, presumably because you have a similar/same situation. I really
appreciate your help.

I would like to eliminate enhancement as a variable. I'll see if I can make
an Ant file for you to add build-time enhancement. Are you using Eclipse?

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com


Mime
View raw message