-->
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.  [ 1 post ] 
Author Message
 Post subject: Gettting Second level cache hit count and miss count
PostPosted: Thu Sep 13, 2007 12:58 am 
Newbie

Joined: Tue Apr 18, 2006 3:50 am
Posts: 6
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:3.2

[b]Mapping documents:<mapping resource="hib/Testtab.hbm.xml" />

[b]Code between sessionFactory.openSession() and session.close():Auto generated using Myeclipse.

Please can somebody tell me how to fetch the second level cache hits and second level cache miss counts. I always get the count as zero for both.
In my stack trace it says that second level cache enabled and also it gives me the second level cache put count.


that part of code is:

Session ss=getSession();
Query query = ss.createQuery("from Testtab");
Testtab tab=new Testtab();
tab.setId(new Long(4));
tab.setName("four");
ss.saveOrUpdate(tab);
List list= query.list();

Statistics stats = sessionFactory.getStatistics();
stats.setStatisticsEnabled(true);

SecondLevelCacheStatistics cacheStats = stats.getSecondLevelCacheStatistics("hib.Testtab");

ss=getSession();
query=ss.createQuery("from Testtab");
query.list();
ss.close();

ss=getSession();
query=ss.createQuery("from Testtab");
query.list();
ss.close();


Important Stack Trace lines::::

INFO Second-level cache: enabled
DEBUG adding entity to second-level cache: [hib.Testtab#1]
DEBUG hib.TesttabCache: MemoryStore miss for hib.Testtab#1
DEBUG hib.Testtab cache - Miss

DEBUG adding entity to second-level cache: [hib.Testtab#2]
DEBUG hib.TesttabCache: MemoryStore miss for hib.Testtab#2
DEBUG hib.Testtab cache - Miss

DEBUG adding entity to second-level cache: [hib.Testtab#3]
DEBUG hib.TesttabCache: MemoryStore miss for hib.Testtab#3
DEBUG hib.Testtab cache - Miss

DEBUG adding entity to second-level cache: [hib.Testtab#4]
DEBUG hib.TesttabCache: MemoryStore miss for hib.Testtab#4
DEBUG hib.Testtab cache - Miss

DEBUG aggressively releasing JDBC connection
DEBUG releasing JDBC connection


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.