[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2815) org.hibernate.stat.SecondLevelCacheStatistics.getEntries fails for Query cache

sebastien kurz (JIRA) noreply at atlassian.com
Fri Aug 31 09:54:24 EDT 2007


org.hibernate.stat.SecondLevelCacheStatistics.getEntries fails for Query cache
------------------------------------------------------------------------------

                 Key: HHH-2815
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2815
             Project: Hibernate3
          Issue Type: Bug
          Components: caching (L2)
    Affects Versions: 3.2.4.sp1
         Environment: Hibernate 3.2.4.sp1 on Oracle with Jboss Treecache 1.4.1 sp4
            Reporter: sebastien kurz
            Priority: Trivial
         Attachments: SecondLevelCacheStatistics.java

sessionFactory.getStatistics().getSecondLevelCacheStatistics("org.hibernate.cache.StandardQueryCache").getEntries(); 
throws an exception because the cache map key is not of type CacheKey but QueryKey

Here is a fix example:
	public Map getEntries() {
		Map map = new HashMap();
		Iterator iter = cache.toMap().entrySet().iterator();
		while ( iter.hasNext() ) {
			Map.Entry me = (Map.Entry) iter.next();
			if (me.getKey() instanceof CacheKey) {
				map.put( ( (CacheKey) me.getKey() ).getKey(), me.getValue() );
			} else {
				map.put( me.getKey(), me.getValue() );
			}
		}
		return map;
	}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list