Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cache issue

tarik el berrak
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.

public Bucket getBucket(String name) {

assert name != null;

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

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

Any help
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!