Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

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

vitalyla

2013-01-14

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

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:

Parent
|
|_ 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
expected.

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 Nabble.com.
©2008 gg3721.com - Jax Systems, LLC, U.S.A.