What do you have openjpa.DetachState set to? Also, can you post the entire
stacktrace? Could you post the enhanced Entity that you're getting the NPE
in?

Thanks,
RIck

On Fri, Nov 11, 2011 at 7:52 AM, M. Walter <marc.wal...@sbb.ch> wrote:

> 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.
>



-- 
*Rick Curtis*

Reply via email to