3 Replies Latest reply on Jan 24, 2014 2:33 PM by smarlow

    Using JCache / JSR-107 with JBoss EAP6.2

    jmsjr

      I would like to use ( or at least POC / experiment ) an implementation of JSR-107 within JBoss EAP 6.2.

      By default, JBoss EAP6.2 now uses Infinispan ( 5.2.7 to be exact ) instead of EhCache as its caching mechanism.

       

      Infinispan is used by Hibernate4 for its 2nd level cache and HornetQ (?) by default within JBoss EAP 6.2.

      So ... looking up at the documentation for Infinispan 5.2.x:

       

      http://infinispan.org/docs/5.2.x/user_guide/user_guide.html#_using_infinispan_as_a_jsr107_jcache_provider    

       

      ...even though the URL above is for Infinispan 5.2.x, .. it says only Infinispan 5.3.x onward will infinispan implement JSR-107.

      So I am at a loss here ...

       

      I would prefer not to have both ehcache and infinispan ... and possibly stick with infinispan because that is what is used by both Hibernate4 and I think HornetQ.

      I would prefer not to change the infinispan module to be 5.3 as that may change or break the behaviour of Hibernate and HornetQ in JBoss EAP6.2

      But it seems I can only have JSR-107 if I add ehcache

       

      Yes, I know that JSR-107 is not due until J2EE7 .. and that I have to add JSR-107 API manually into JBossEAP manually as a module.

      I only want to use the API for JSR-107 .. not the annotations.

       

      Any suggestions ?

        • 1. Re: Using JCache / JSR-107 with JBoss EAP6.2
          smarlow

          JPA 2.1 does not require persistence providers to work with JSR-107 caches.  I don't think JSR-107 made it into EE 7. 

           

          How are you expecting to experiment with JSR-107?  Perhaps directly from your application code?  If yes, I suspect that you could do this.

           

          I just don't expect Hibernate to use JSR-107 as a second level cache.  If that is your goal, I can suggest how you could hack on making that happen (upstream in the Hibernate project).

           

          Scott

          • 2. Re: Using JCache / JSR-107 with JBoss EAP6.2
            jmsjr

            Scott Marlow wrote:

             

            JPA 2.1 does not require persistence providers to work with JSR-107 caches.  I don't think JSR-107 made it into EE 7.

             

             

            Ah .. but doesn't Hibernate4.2 itself ( not JPA ) use Infinispan direc

             

             

            How are you expecting to experiment with JSR-107?  Perhaps directly from your application code?  If yes, I suspect that you could do this.

             

            I just don't expect Hibernate to use JSR-107 as a second level cache.  If that is your goal, I can suggest how you could hack on making that happen (upstream in the Hibernate project).

             

            Scott

             

            I understand that Hibernate doesn't use JSR-107 for its cache, but doesn't it depend on Infinispan ( e.g. use the Infinispan API directly ) ? ... although the module.xml says infinispan is optional.

             

            My goal is to avoid having to code against the Infinispan API and use the javax.cache API instead .. and has nothing to do with using JSR-107 as a second-level cache in Hibernate.

            I would coding against the javax.cache API directly from my application code.


            If I have to code against the javax.cache API, the Infinispan documentation says I should use at least Inifinispan 5.3 .... but that would mean making also Hibernate use Infinispan 5.3, when the supported configuration in EAP is Hibernate 4.2 with Infinispan 5.2.

             

            I know I can have a different slot for the Inifinispan module for 5.3, but because my application also uses Hibernate, my application can therefore only use one version / slot of Infinispan. In the end, if it is too hard to use javax.cache API in EAP 6.2 due to the reliance on Infinispan 5.3 .. I may just have to stick with Infinispan 5.2 and use the Infinispan API directly.


            BTW .. sad to hear that JSR-107 did not make it to EE7. It really is the longest running JSR ever ! ... 13 years and still going.




             

            • 3. Re: Using JCache / JSR-107 with JBoss EAP6.2
              smarlow

              Hibernate4.2 does use/depend on Infinispan directly but the Hibernate jars on in their own separate (module) classloader.

               

              Does your application have a direct dependency on Infinispan?  Or only on Hibernate?  If your already referencing Infinispan classes from your application, then you definitely depend on Infinispan but just using Infinispan as the Hibernate second level cache doesn't mean that your application has a direct dependency on Infinispan.

               

              By the way, there is a community survey for EE 8 that you could fill out (if you want to ask for JSR-107 support to be included).