-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JPA-32: Setting cacheable="true" in orm.xml does not enable
PostPosted: Fri Jun 29, 2012 10:48 am 
Newbie

Joined: Thu Jun 14, 2012 11:00 am
Posts: 5
Test Case for defining JPA caching

When selective caching and second level cache is enabled through the JPA persistence.xml configuration file, entites that are defined in orm.xml with cacheable="true" attribute are not cached in the second level cache.

Entities that are annotated @Cacheable(true) are cached correctly

This test case test the following 4 scenarios

Entity is annotated with @Cacheable(true)
Entity is defined as cacheable in orm.xml
Entity is defined as cacheable with hibernate.ejb.classcache in persistence.xml
Entity has not been defined as cacheable and therefore should not be cached

Methodology
For each test

A new customer is created and persisted through JPA.
A JDBC call is made to update CUST_CREDIT value directly to database by picking a connection from connection pool and executing a SQL statement
The customer entity is retrieved through JPA by finding on PK
The customer availableCredit property of the retrieved object is compared to the CUST_CREDIT value set in step 2
If availableCredit==CUST_CREDIT, the entity has not been cached. if availableCredit!=CUST_CREDIT, the entity has not been cached.

Expected Results

a) Annotated Entity cached==true
b) XML Entity cached==true
c) Hibernate defined Entity cached==true
d) Not cached Entity cached==false


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.