-->
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.  [ 6 posts ] 
Author Message
 Post subject: Turn off second level cache for a session
PostPosted: Thu Sep 14, 2006 6:44 pm 
Newbie

Joined: Wed Apr 20, 2005 11:22 am
Posts: 4
Hibernate version: 2.1.8

Hi,

Is there a way to turn off all writes/updates to the second level cache for the duration of a session?

Thanks,

Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 9:52 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Try this key/value pair in your configuration "hibernate.cache.provider_class" "org.hibernate.cache.NoCacheProvider"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 9:53 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
... or at least find the 2.x equivalent of this.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 11:44 pm 
Newbie

Joined: Wed Apr 20, 2005 11:22 am
Posts: 4
dennisbyrne wrote:
Try this key/value pair in your configuration "hibernate.cache.provider_class" "org.hibernate.cache.NoCacheProvider"


How would I alter that value on a per-session basis? I can't find anything in the SessionFactory or Session interfaces that would allow you to alter the configuration locally. Basically I want one particular sessions to not have a cache, but all others to have one.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 1:16 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
If you want to clear the session, call session.clear()


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 1:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
session.setCacheMode(CacheMode.IGNORE)

don't recall when it was added. probably in H3.x.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.