Pessoal estou tentando implementar o cache no Hibernate, mas na segunda consulta me da este erro:
Caused by: java.lang.ClassCastException: net.sf.ehcache.store.chm.SelectableConcurrentHashMap$DummyPinnedKey
at org.hibernate.cache.QueryKey.equals(QueryKey.java:54)
at net.sf.ehcache.Element.equals(Element.java:314)
at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$MemoryStoreSegment.get(SelectableConcurrentHashMap.java:631)
at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$MemoryStoreSegment.get(SelectableConcurrentHashMap.java:330)
at net.sf.ehcache.store.chm.ConcurrentHashMap.get(ConcurrentHashMap.java:776)
at net.sf.ehcache.store.MemoryStore.get(MemoryStore.java:311)
at net.sf.ehcache.store.MemoryStore.getQuiet(MemoryStore.java:328)
at net.sf.ehcache.store.FrontEndCacheTier.getQuiet(FrontEndCacheTier.java:226)
at net.sf.ehcache.Cache.searchInStoreWithoutStats(Cache.java:2097)
at net.sf.ehcache.Cache.get(Cache.java:1624)
at net.sf.ehcache.hibernate.EhCache.get(EhCache.java:93)
at org.hibernate.cache.StandardQueryCache.get(StandardQueryCache.java:105)
at org.hibernate.loader.Loader.getResultFromQueryCache(Loader.java:2161)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2126)
at org.hibernate.loader.Loader.list(Loader.java:2096)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
at br.com.vivo.daos.GenericDaoBeanVivo.consultaPorNamedQuery(GenericDaoBeanVivo.java:146)
at br.com.vivo.session.ProdutoServiceBean.consultaTodos(ProdutoServiceBean.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
... 93 more
Alguem me ajuda?