This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Clearing L2 Cache using hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Clearing L2 Cache using hibernate" Watch "Clearing L2 Cache using hibernate" New topic
Author

Clearing L2 Cache using hibernate

rudresh kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 83
HI All,

I have configured in such a way that, i run a servlet which pulls the data from database and puts in to the L2 cache and i refer this cache hereafter. Problem is when ever updation is done on the datbase, the only way my L2 cache gets updated is by restarting my server and again running my servlet.
Is there a way to clear the L2 cache. if so is that entire L2 cache will be deleted or is there a way to clear only few object without restarting the server

if possible kindly let me know some examples
Thanks
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Yes, first when you define your cache regions for the second level cache, you put the level of updating that would occur, I think as the isolation level. This makes the second level cache update when an update occurs, as long as that update occurs in the same application, if some legacy app changes the data, Hibernate will not know that data has changed and your 2l cache will have stale data.

To evict from Second Level cache you use the evict methods on the SessionFactory, it can evict all or single objects.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clearing L2 Cache using hibernate
 
Similar Threads
session.invalidate doubt
Do we always need restarting Tomcat ?
Overseas Caching?
When is a servletcontext destroyed?
Websphere acting funny