openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <>
Subject Re: Strange behaviour on ManyToMany relationship using RCP client
Date Mon, 14 Nov 2011 14:17:14 GMT
Walter -

Thanks for the additional debug info.... I assumed that you were using a
DetachedStateManager, but I wanted to have you confirm for me.

The problem is that you are accessing an unloaded field while this Entity
is detached. I agree with you that we shouldn't be throwing an NPE... but
if we were to fix this NPE, OpenJPA would still have to ignore your
change[1]. I think your best best is to load the lazy collection prior to
streaming to the client. Another property you might want to look at is
openjpa.DetachState(AccessUnloaded=false). This property will throw an
exception when/if you try to access a field that isn't loaded.


[1]  [JSR-317 Final Release - pg 81] "The persistence provider must not
merge fields marked LAZY that have not been fetched: it must ignore such
fields when merging."

On Mon, Nov 14, 2011 at 3:33 AM, M. Walter <> wrote:

> Hi Rick,
> sorry I wasn't right. The two entities are NOT being created at the client
> side but they are read from the server via RMI. Then the add() method of
> one
> of them is called in order to create a new ManyToMany relationship between
> these two entities. The add() method then calls the other entities' add()
> method and the NPE is raised (I showed you the line the exception occurs).
> We casted the entity to PersistenceCapable as you requested.
> In our JUnit integration test a
> state manager is used
> (this works).
> In our RCP client a org.apache.openjpa.kernel.DetachedStateManager state
> manager is used (this fails).
> --
> View this message in context:
> Sent from the OpenJPA Users mailing list archive at

*Rick Curtis*

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message