openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M. Walter" <marc.wal...@sbb.ch>
Subject Strange behaviour on ManyToMany relationship using RCP client
Date Fri, 11 Nov 2011 13:52:40 GMT
In our (RCP) client/server application a JAR is packaged on both sides
containing all build time enhanced entities.
Now we have a ManyToMany relationship with a join table defined. When we add
both entities to each other to create a new relationship between two
entities a und b everything works fine on the server side.
But on the client side we get a very strange NullPointerException at a
position we thought a NPE is not possible. Please have a look at our code:

Entitiy A:
public void addB(final B b) {
    if (bList == null) {
        bList = new ArrayList&lt;B&gt;();
    }
    if (!bList.contains(b)) {
        bList.add(b);
        b.addA(this);
    }
}

Entity B:
public void addA(final A a) {
    if (aList == null) {
        aList = new ArrayList&lt;A&gt;(); // this code is executed but aList
is not initialized. Why?
    }
    if (!aList.contains(a)) { // NullPointerException here!! aList is null!
        aList.add(a);
        a.addBp(this);
    }
}

Does anyone have a hint why this is happening (and on client side only)?

--
View this message in context: http://openjpa.208410.n2.nabble.com/Strange-behaviour-on-ManyToMany-relationship-using-RCP-client-tp6985422p6985422.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message