openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <daryl.stu...@opentempo.com>
Subject Evicting
Date Fri, 04 Feb 2011 20:42:01 GMT
Hello,

I have some legacy code that deletes data in a JDBC transaction so I can't
use an EM to delete a "case". After the delete I need to get the object out
of the L1 cache. So I do this:

OpenJPAEntityManager oem = (OpenJPAEntityManager)
ExecutionResources.getEntityManager();
System.out.println("Before, em contains case: " +  oem.contains(myCase) + "
detached: " + oem.isDetached(myCase));
oem.detach(myCase);
oem.evict(myCase);
System.out.println("After evict, em contains case: " +  oem.contains(myCase)
+ " detached: " + oem.isDetached(myCase));
CaseUtils.delete(myCase, editingUser);
System.out.println("After delete, em contains case: " +
 oem.contains(myCase) + " detached: " + oem.isDetached(myCase));


Which prints out this:

Before, em contains case: true detached: false
After evict, em contains case: true detached: false
After delete, em contains case: true detached: false


(I threw in the detach stuff as experimentation, tried it first without
it.)

Am I not understanding how this should work? I am not using L2 cache, I'm
expecting evict to remove it from the L1 cache. I have one other use of
evict in my app and it seems to be doing what I expect (though it's a JDBC
update, not a delete).

I'm using OpenPJA 1.2.2.

Thanks.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
http://www.opentempo.com
mailto:daryl.stultz@opentempo.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message