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 data from a cache
PostPosted: Tue May 09, 2006 11:07 am 
Newbie

Joined: Thu Apr 20, 2006 3:36 am
Posts: 13
hiiiii all,

i have cached a tables data using EHCacheprovider.How can i retrieve the cached data ??? I have written the code shown below. I am able to get the size of the cache but when i pass the id in the get() method it return me the data enclosed in curly brackets... How can i get the data from this format ???

CODE :
------
Map userList = new HashMap();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
userList = sessionFactory.getStatistics().getSecondLevelCacheStatistics ("user").getEntries();

System.out.printlnuserList.get(id));



OUTPUT :
--------
Item{version=null,freshTimestamp=4698877591896064

(earlier i used to get all the values vth the name as specified in the hbm.xml file along with the version n lazy property.. I dint make any change to the code... but all of a sudden started getting this result.Can anyone explain why ???)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 7:00 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You printed out one of the statistic nodes, not an actual piece of cached data. To use EhCache once you've got the provider, check out EhCache's docs: http://ehcache.sourceforge.net/.

_________________
Code tags are your friend. Know them and use them.


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.