Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] NullPointerException in 2.3.2 while persisting

On Thu, Aug 29, 2013 at 10:38 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
The stack is the same as this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=391036

Is there any chance one of the involved entities is not listed as part of the persistence unit?

Yes, there is; I'll explain.

(First, while I'm thinking about it, a nod of thanks and appreciation to this list and all you fine upstanding EclipseLink folks; I've learned a ton here and everyone is courteous under pressure.  Kudos.)

The field in question being traversed is in PostalAddressEntity:

@ManyToOne(insertable = false, updatable = false)
private Constituent c;

I have an Organization ("is a" Constituent) that is not managed by this persistence unit, but by the other (I'm in an XA setup where there are two EntityManagers).  It is set into this "c" field.

I thought that by marking the field insertable/updatable false that even if I stashed an object from another persistence unit in there EclipseLink would not bother to checkForUnregisteredExistingObject(), since by definition this field would not be included in any flush() operation.  I guess that is not the case.

The root cause is line 752 in UnitOfWorkImpl.java; there should probably be a null check on descriptor--which, if true--should simply return false.  This is basically the same state of affairs that occurs when the primary key can't be extracted a couple of lines later.

Best,

Back to the top