openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <>
Subject Re: Evicting an embedded object.
Date Fri, 27 Mar 2009 14:38:25 GMT

Ravi -
Can we get a full testcase? 


Hi all,

I have a question regarding evicting an embedded object.

When I call an evict on a persistent non-transactional object and if I call isPersistent()
before and after evict then both returns true.

When I do the same for an embedded object then I get false on the isPersistent() call after

I did not find any documentation around evicting an embedded object.

The way I understand Evict is that it removes the object from cache but why is the persistence
capability of the embedded object is removed and also why is it not consistent with a non-embedded
object ?

Here is a sample code, lets say there is an Order object (@Entity) and comment object (@Embeddable)
that is embedded inside Order.

The following returns true, true ( outside transaction boundaries):

System.out.println("isPersistent:" + OpenJPAEntityManager.isPersistent(ord));
System.out.println("isPersistent:" + OpenJPAEntityManager.isPersistent(ord));

The following returns true, false ( outside transaction boundaries):

Comment ord_cmt = ord.getComment();
System.out.println("isPersistent:" + OpenJPAEntityManager.isPersistent(ord_cmt));
System.out.println("isPersistent:" + OpenJPAEntityManager.isPersistent(ord_cmt));

Please let me know if you need a complete test case.

OpenJPA version: openjpa-1.1.0-r422266:657916


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message