-->
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.  [ 2 posts ] 
Author Message
 Post subject: how to retrieve the data from a cache into session
PostPosted: Wed Dec 06, 2006 8:45 am 
Newbie

Joined: Mon Sep 18, 2006 9:46 am
Posts: 13
Hi,

I am storing the data inside a cahe. How can i retrieve the data from a cache into session.



public Country findCountryByCode(String code) {
return (Country) SessionManager.currentSession()
.createQuery("from Country as c where c.code = :code")
.setParameter("code",code)
.uniqueResult();
}

and i change the hibernate.cfg.xml

<property name="hibernate.cache.provider_class">
org.hibernate.cache.EHCacheProvider
</property>

Now the data is stored inside a cache.

Now i want to retrieve the cache data into session.

Please provide any code to store the cache data into session.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 06, 2006 1:17 pm 
Regular
Regular

Joined: Mon May 22, 2006 2:30 pm
Posts: 74
I think you have some misconceptions about caching. You don't have to explicitly retrive data from the cache. It's transparent. Hibernate uses the cache automatically. It may eliminate some unneccessary disk accesses. You don't not have to do anything different in your code to "use" the cache, once you have it configured.


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