-->
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: Hibernate and Ehcache
PostPosted: Fri Jan 14, 2011 10:24 am 
Newbie

Joined: Thu Jan 13, 2011 8:20 am
Posts: 3
Hello everyone,

I use to JBoss [EAP] 5.0.0.GA, Hibernate 3.3.2.GA and ehcache-core-2.0.0. I did my config files from ehcache page.
My peesistence.xml
Code:
<property name="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory"/>
            <property name="net.sf.ehcache.configurationResourceName" value="META-INF/ehcache.xml"/>
            <property name="hibernate.cache.use_minimal_puts" value="false"/>
            <property name="hibernate.cache.use_query_cache" value="true"/>
            <property name="hibernate.cache.use_second_level_cache" value="true"/>

Everything looks good when the server starts:


INFO [SettingsFactory] JPA-QL strict compliance: enabled
INFO [SettingsFactory] Second-level cache: enabled
INFO [SettingsFactory] Query cache: enabled
INFO [SettingsFactory] Cache region factory : net.sf.ehcache.hibernate.EhCacheRegionFactory
INFO [SettingsFactory] Optimize cache for minimal puts: disabled
INFO [SettingsFactory] Structured second-level cache entries: disabled
INFO [SettingsFactory] Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
INFO [SettingsFactory] Statistics: enabled
INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
INFO [SettingsFactory] Default entity-mode: pojo
INFO [SettingsFactory] Named query checking : enabled


but if I want to use my cached data, I have:

Code:
Caused by: java.lang.NullPointerException
   at net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy$Item.isWriteable(AbstractReadWriteEhcacheAccessStrategy.java:250)
   at net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy.putFromLoad(AbstractReadWriteEhcacheAccessStrategy.java:91)
   at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:179)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
   at org.hibernate.loader.Loader.doQuery(Loader.java:752)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
   at org.hibernate.loader.Loader.doList(Loader.java:2232)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
   at org.hibernate.loader.Loader.list(Loader.java:2124)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1597)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
   at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328)


Have you ever seen something like this?


Top
 Profile  
 
 Post subject: Re: Hibernate and Ehcache
PostPosted: Wed Mar 09, 2011 8:28 am 
Newbie

Joined: Thu Jan 13, 2011 8:20 am
Posts: 3
Solved. I had to split entities to different regions. (read, read_write etc).


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.