2 Replies Latest reply on Jul 4, 2012 8:15 AM by Tomaz Cerar

    Hibernate 4.0.1 second level cache not enabled

    mike just Master

      I am using Hibernate 4.0.1 with JBoss 7.1.1. Now I am getting this error about the second-level cache.


      19:05:34,914 ERROR [com.demo.util.testMDB] (Thread-3 (HornetQ-client-global-threads-1905728914))  org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]


      I have added



      hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider


      in hibernate.cfg.cml and



      ## disable the second-level cache
      #hibernate.cache.use_second_level_cache false


      should mean the second-level cache is enabled by default. I also changed it to


      hibernate.cache.use_second_level_cache true


      and add


      hibernate.cache.use_query_cache true


      but still got no luck.



      Any hint where I got it wrong?