3 Replies Latest reply on Apr 7, 2009 11:54 PM by gonorrhea

    Query- and second-level cache in Seam and Tomcat

    yuriy_zubarev
      Hi.

      I've been spinning wheels trying to make query- and second-level Hibernate cache to work in my app. I went through "wiki" example and numerous resources on-line but still having a problem.

      My set-up is a bit different than all the examples I saw and therefore I wanted to see if other people succeeded with caching having a similar set-up.

      My differences:

      1) Using a plain Tomcat 6 (shouldn't make a difference as far as caching is concerned but I want to mention it anyway).
      2) My domain objects (JPA entities) and persistence.xml are managed as a separate project outside of Seam web app project. Domain objects are JARed up and used in Seam web app afterward (it's all based on Maven, so it's quite easy)

      persistence.xml looks fine:

      <property name="hibernate.cache.use_query_cache" value="true"/>

      <property name="hibernate.cache.use_second_level_cache" value="true"/>

      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>

      I also provide hints when dealing with Entity Manager:

      .setHint("org.hibernate.cacheable", true)

      Any other hints from the community?

      Thanks,
      Yuriy