-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate Second Level Cache Entities in Servlet Context
PostPosted: Wed Nov 02, 2005 11:36 pm 
Beginner
Beginner

Joined: Sat Nov 22, 2003 3:54 pm
Posts: 42
Hibernate version:3.0.5

Hi,

I need your advice on this Hibernate Gurus, in our J2EE system ( to be deployed on WAS 6.0 with cluster support), there are several master data tables, which gets updated very infrequently may be once a week or even in a month.

a) I would like to get those master data tables through hibernate and make use of the cache tag to store them in second level cache(jboss cache or oscache) and once loaded may be through a servlet filter, we would like to make use of these entities in our struts classes.

b) Hibernate session is bound to JTA Transaction as we are running all the database related dao classes within session bean context.

Now as i pointed out, i would like to have these second level cache entities available in my struts classes may be through servlet context? Now the query is i dont want to get these entities throug a "get" from Hibernate Session, is there somehow we can retrive these second level cache objects without going through Hibernate Session, but also have the flexibility that when they are updated, the second level cache also gets updated.

Any hint guys.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 11:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You can, though this is not a good idea.

If you really, really want to, get a handle to the instantiated CahceProvider from the session factory and use it. Or, conversely, get the appropriate persister from the session factory and get its enabled cache reference and use that (though that actually returns an instance of something called CacheConcurrencyStrategy). Have fun...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 5:53 pm 
Beginner
Beginner

Joined: Sat Nov 22, 2003 3:54 pm
Posts: 42
Thanks Steve for the reply? Do you think that maintaining 2 caches of the same data is a good idea, but then all synchronization also need to happen. What do you suggest.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 11:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I suggest you use load or get ;)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 4:31 pm 
Beginner
Beginner

Joined: Sat Nov 22, 2003 3:54 pm
Posts: 42
Hi Steve,

Thats what i didnt really wanted to do, as to get some cached data like on some custom jsp tags or in some struts action classes, i have to get it every time through Hibernate Session, that kinda seem too much? But then the whole pleothera of questions will come in picture that how the data will be synchronized when it is updated, if i dont go through session's get or load. May be i have to look more into the cache provider and hook this thing in there?

Any other hints ?

Thanks


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