Daryl,

The more I am digging into this, it looks to me that your linked entity is
going to be null or the linked entity has an entity linked to it is null.

I know you said that your key is valid, but have you logged the complete
entity all the way though the cascaded entities? Looking back on all my
problems with this issue it seems that somewhere in the cascaded entities is
a bad linked entity and the exception is flowing back up to the top and
reporting the error on the upper entity. This seems to be the root cause as
far as I can see so far.

Also I'm not sure you responded to my question regarding the exception being
very intermittent, when I duplicate this issue, in most cases the exception
is like this:

SEVERE: Encountered new object in persistent field
"com.trm.core.Asset.vendor" during attach.  However, this field does not
allow cascade attach. Set the cascade attribute for this field to
CascadeType.MERGE or CascadeType.ALL (JPA annotations) or "merge" or "all"
(JPA orm.xml). You cannot attach a reference to a new object without
cascading.
<openjpa-1.2.1-r752877:753278 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Encountered new object in
persistent field "com.trm.core.Asset.vendor" during attach.  However, this
field does not allow cascade attach. Set the cascade attribute for this
field to CascadeType.MERGE or CascadeType.ALL (JPA annotations) or "merge"
or "all" (JPA orm.xml). You cannot attach a reference to a new object
without cascading.
FailedObject: com.trm.core.suppl...@175831e
        at
org.apache.openjpa.kernel.AttachStrategy.getReference(AttachStrategy.java:28
1)
        at
org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:194
)
        at
org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy
.java:153)
        at
org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
        at
org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)

But under the very same conditions, I am getting the same exception you
reported. So my suspicion is that you may be in some way handling the above
exception, hence your not getting an error, but in the case where it throws
your exception every x times, you are not handling that exception and hence
things blow up. 

I don't yet understand why the exceptions are changing even when the same
code path and data is being processed, I suspect it may have to do with the
sequence in which I am performing some operations before I am running my
bugged process, but I'm still trying to work that out.

Just my thoughts.

Chris


-----Original Message-----
From: Daryl Stultz [mailto:[email protected]] 
Sent: Thursday, 17 September 2009 4:50 AM
To: [email protected]
Subject: Re: SingleFieldManager crash

On Wed, Sep 16, 2009 at 4:32 PM, C N Davies <[email protected]> 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:[email protected]

Reply via email to