hi. I have performed the quering of db2 from Rest service (servlet) using
native queries (openjpa-2.0.1). I need to cache data (entities) using
different eviction algorithms for most of them. I have three questions.
1) are native queries supposed to be cached (if appropriate configuration in
persistance.xml are done, see code below)
2) are data returned from the native queries supposed to be cached?
3) how can I access the eviction algorithm stored in the EvictionSchedule
properties? I want to introduce caching on another layer (http expiration/
etags) based on the same eviction configuration. Namely, if JPA eviction
schedule is supposed that data needs to be expired only on Monday, please
set up the same http expiration.
Thanks
code:
Query
public List<Year> getCycles() {
Query query = em.createNamedQuery(...)
return query.getResultList();
}
Entity
@Entity
@DataCache(name="cycle-cache")
public class Cycle{}
persistence.xml
<property name="openjpa.QueryCache" value="true"/>
<property name="openjpa.RemoteCommitProvider" value="sjvm"/>
<property name="openjpa.DataCache" value="true(Name=cycle-cache,
CacheSize=100, EvictionSchedule='...some eviction rule is here... like 15,45
15 * * 1 ')"/>
--
View this message in context:
http://openjpa.208410.n2.nabble.com/cache-queries-and-data-from-native-queries-tp5598754p5598754.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.