0 Replies Latest reply on Jan 22, 2013 12:24 PM by hiro kobayashi

    @Cacheable is ignored when orm.xml is used in JBoss7.1.3 + JPA(Hibernate) + Infinispan

    hiro kobayashi Newbie

      Hi, I’m trying to use JPA second level cache on JBoss AS 7.1.3.Final and trying to:


      • Use @Cacheable annotation for selective entity caching.
      • Use orm.xml only for named queries.
      • Use JPA backed by Hibernate
      • Use Infinispan as the second level cache provider


      When second level cache and selective caching is enabled through persistence.xml, @Cacheable annotation is ignored and the entities won’t get cached in L2 cache.


      Here is a part of my persistence.xml


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


      I also found :

      • This doesn’t happen on 7.1.1.Final or 7.1.2.Final
      • This happens with 7.2 (nightly build on Jan 20, 2013)
      • If I give up using @Cacheable annotation and add entity elements with cacheable=”true” in orm.xml, L2 cache works, but I want to use @Cacheable annotation along with orm.xml.
      • Using DISABLE_SELECTIVE in persistence.xml, @Cacheable(false) is ignored and all entities are cached.


      Is this a bug?

      Any idea?