openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpalache <ravi.palache...@oracle.com>
Subject Evicting an embedded object.
Date Tue, 24 Mar 2009 17:49:41 GMT

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

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));
OpenJPAEntityManager.evict(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));
OpenJPAEntityManager.evict(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

Regards,
Ravi.
-- 
View this message in context: http://n2.nabble.com/Evicting-an-embedded-object.-tp2528068p2528068.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message