-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate second level cache
PostPosted: Thu Jul 05, 2007 10:47 am 
Regular
Regular

Joined: Mon Jun 12, 2006 5:33 am
Posts: 63
Hibernate version: 1.2.6
database : SQLServer

I'm trying to use the second level cache to cache resultsets.
The configuration looks like:

Code:
hibernate.cache.use_query_cache true


Code:
List blogs = sess.createQuery("from Blog blog where blog.blogger = :blogger")
    .setEntity("blogger", blogger)
    .setCacheable(true)
    .list();

The problem: When returning certain results the values are different from the ones in the database.
There are many threads accessing the code. Is it possible that the cached results are being used accessed by different threads?

E.g:
thread_1 : blogger.value = 1
thread_2 : blogger.value = 1

But in the database :
thread_2 : blogger.value = 2

Any idea? Is it because of the second level cache?

Thanks for your help.

chucky


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 11:25 am 
Regular
Regular

Joined: Mon Jun 12, 2006 5:33 am
Posts: 63
Sorry the hibernate version is : 2.1.6

chucky


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 3:37 pm 
Beginner
Beginner

Joined: Mon Mar 06, 2006 2:19 pm
Posts: 42
Location: Belo Horizonte, Brazil
It's simple to know. Turn off the 2nd level cache and test. :)

And please. Post the results.


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.