db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Fwd: Evicting an embedded object.
Date Fri, 27 Mar 2009 23:06:37 GMT
This sounds familiar...

Craig

Begin forwarded message:

> 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.-tp2528068p2544592.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message