You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Jean Andriamalala <je...@hotmail.com> on 2009/10/02 13:44:12 UTC

Using non persistent field with Kodo L2 Entity datacache

Hello All,
 
I configured an Entity cache (@DataCache) using OpenJpa and I would like to cache also a non persistent field computed dynamically as the computation of this field is expensive. The scenario is as following:
 
1. Entity is retrieved from db using a query
2. In PostLoad method, the non persistent field is computed
3. Entity is retrieved again using the same query
4. Persistent attributes are retrieved from the cache
5. However, the non persistent field is null and so it is computed again inPostLoad method
 
Is there a way to cache a non persistent field to avoid the computation? EJB 2.0 cache allows this but I haven't figured out how to do this with Kodo Entity cache. 
 
Thanks,
 
Jean 		 	   		  
_________________________________________________________________
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

RE: Using non persistent field with Kodo L2 Entity datacache

Posted by Ravi Palacherla <ra...@oracle.com>.
Hi Jean,

Did you get a chance to create a testcase for this ?
I created one and the results are different than your's.
After running the query for second time, it pulled both the persistent and transient fields of the entity from the cache.
So, can you please verify my testcase (attached) and see if I am doing anything different from what you mentioned in your email.
To run my testcase go to ant folder , change the values inside build.xml to reflect your environment.
Run "ant" from ant folder.

Regards,
Ravi.	

-----Original Message-----
From: Jean Andriamalala [mailto:jean_andria@hotmail.com] 
Sent: Friday, October 02, 2009 5:44 AM
To: users@openjpa.apache.org
Subject: Using non persistent field with Kodo L2 Entity datacache


Hello All,
 
I configured an Entity cache (@DataCache) using OpenJpa and I would like to cache also a non persistent field computed dynamically as the computation of this field is expensive. The scenario is as following:
 
1. Entity is retrieved from db using a query
2. In PostLoad method, the non persistent field is computed
3. Entity is retrieved again using the same query
4. Persistent attributes are retrieved from the cache
5. However, the non persistent field is null and so it is computed again inPostLoad method
 
Is there a way to cache a non persistent field to avoid the computation? EJB 2.0 cache allows this but I haven't figured out how to do this with Kodo Entity cache. 
 
Thanks,
 
Jean 		 	   		  
_________________________________________________________________
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx