0 Replies Latest reply on Feb 27, 2017 5:47 AM by Prabal Rakshit

    Hibernate L2 Cache with Jboss EAP

    Prabal Rakshit Newbie

      Hi All,



      We are working on a project with the following technology combinations:

      Jboss FUSE 6.3.0

      Jboss EAP 6.4.0



      A key requirement is for us is to use Hibernate Level 2 caching for some read services. As per the Jboss EAP 6.4.0 development guide (13.2.5. Second-Level Caches) this can be done by configuring persistence.xml etc.



      We had a few questions on that:

      - Is it a norm to use the 'hibernate' cache container for this purpose? In that case the 'entity' and 'local-query' caches are used for entity and query caching respectively?

      - If we intend to change the settings of the hibernate cache container, e.g. expiration, eviction etc. is it risky to do so to the hibernate cache container?



      - In that case is it better to configure a new cache container altogether?



      - Jboss EAP 6.4.0 administration guide (Chapter 13. Infinispan) clearly mentions that the hibernate cache should not be used directly by the user applications. It also advises against users creating their own cache containers and referring to them via JNDI. In that case what is the recommended approach for L2 caching.



      - We have Apache Camel as the main integration tool. We have tried using the Camel JPA component to query the database. But we see that the queries always bypass the cache and hit the database. However if we use an EntityManager.find, the cache is hit first.

      Any suggestions on why this could be the case?



      Thanks and regards,