-->
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: setCacheable, @Cache without 2nd Level Cache
PostPosted: Sun Jul 18, 2010 10:54 am 
Beginner
Beginner

Joined: Sun Apr 25, 2010 7:14 am
Posts: 30
Hi,

i am developing a project using hibernate. In deployed state i want to use 2nd level cache but i don't in "developing mode". I thought
that it would be enought to disable the cache in the hibernate.cfg.xml but this seems not to be true. If i just remove the cache from
the xml-files but not from the beans (@Cacheable, @Cache) i get an error.

What to do to disable caching without changing the definition of every bean (a lot)?

Yours
Werzi2001


Top
 Profile  
 
 Post subject: Re: setCacheable, @Cache without 2nd Level Cache
PostPosted: Sun Jul 18, 2010 1:50 pm 
Newbie

Joined: Thu Jul 15, 2010 6:44 am
Posts: 13
From the top of my head, one programmatic way, if you have your data access encapsulated, you could control the behavior using CacheMode.IGNORE at session level in development mode.

So every time before you query/load/get using session, just set the session's CacheMode.IGNORE, in theory this should work.

Hope that helps.

_________________
Vikram.
Http://enterprisejava4u.blogspot.com


Top
 Profile  
 
 Post subject: Re: setCacheable, @Cache without 2nd Level Cache
PostPosted: Sun Jul 18, 2010 3:03 pm 
Beginner
Beginner

Joined: Sun Apr 25, 2010 7:14 am
Posts: 30
Hi,

thanks for your help. It did work but i wanted something that works without changing the code (hibernate.cfg.xml). So i implemented a dummy IgnoreCacheProvider that simply does nothing. Works for me :)

Yours
Werzi2001


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.