Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cache issue

 
tarik el berrak
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm using Hibernate second level cache,
I use setCacheable(true) on my criteria to tell hibernate to use the cache, but it seems that hibernate launch the query everytime even if the data doesn't change.



@Transactional(propagation=Propagation.SUPPORTS)
public Bucket getBucket(String name) {

assert name != null;

Criteria crit = getCurrentSession().createCriteria(Bucket.class);
crit.setCacheable(true);
crit.add(Restrictions.eq("bucketName", name));

Bucket bucket = (Bucket) crit.uniqueResult();
return bucket;
}








Any help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic