Java Mailing List Archive

Home » users.openjpa »

EntityManager.clear() doesn't totally detaches an entity



Replies: Find Java Web Hosting

Author LoginPost Reply

I am facing an issue with detached entities when using EntityManager.clear()
operation along with Local EJB.
Lets consider the case in which entity is returned from the query and later
detached by invoking clear() API:

|_ Child (LAZY fecthed)

implementation of getChild in Parent entity:

Child getChild () {

if (child == null) { child = new ArrayList....; }

return child;

The problem is that when Parent entity is detached through /clear()/ API it
is very common that at line when /child /object is returned it is still
NULL, regardless the fact that it was initialized a line before.

But, when the same entity Parent is getting detached through
*serialization*, query exposed as remote EJB, then everything works as

After checking an enhanced class it was found out that some state is
preserved in StateManager internal class when clear() is invoked but is
cleaned-up upon serialization.

Please advise if it is a bug or this is how it works in: Local EJB +
EntityManager.clear() constellation.

Sent from the OpenJPA Users mailing list archive at
©2008 - Jax Systems, LLC, U.S.A.