3 Replies Latest reply on Jan 18, 2012 1:59 PM by smarlow

    Deploying JPA 2 (OpenJPA 2.1.0) on Jboss 7.1.0-Final-Snapshot

    sathwik.bp

      Hi,

      I have managed to configure the module openjpa.

      My module.xml is as follows, though may be some more dependencies need to be added. I will be able to identify them when I run my applciation. Right now this configuration has successfull deployed my web applciation which uses openjpa.

       

      {code:xml}<module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa">

          <resources>

              <resource-root path="openjpa-2.1.0.jar"/>

              <resource-root path="serp-1.13.1.jar"/>

              <!-- Insert resources here -->

          </resources>

       

          <dependencies>

              <module name="javax.persistence.api"/>

              <module name="javax.transaction.api"/>

              <module name="javax.validation.api"/>

              <module name="org.apache.commons.lang"/>

              <module name="org.apache.commons.collections"/>

              <module name="org.apache.log4j"/>       

          </dependencies>

      </module>{code}

       

      My question is if an application uses a different version of OpenJPA lets say 2.1.1, how would it be possible to specify Jboss to load the openjpa library from the application lib.

       

      I am coming from this https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide , which allows Jboss to load the library from the application.

      <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />

       

      regards,

      sathwik

        • 1. Re: Deploying JPA 2 (OpenJPA 2.1.0) on Jboss 7.1.0-Final-Snapshot
          smarlow

          Hi,

           

          Yes, the providerModule name which can include a version (slot) also.  For example, you placed your OpenJPA jars in the AS7/module/org/apache/openjpa/main folder.  To specify this module, you could add <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa" /> or <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa:main" />.

           

          If you add a second version of the OpenJPA module (2.1.1), you would place that in AS7/module/org/apache/openjpa/2.1.1 (replace 2.1.1 with whatever you want, if you prefer something else). The slot for this different version, is now called "2.1.1" and can be referenced via <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa:2.1.1" />.

           

          Lets say, you instead put the jars in the AS7/module/org/apache/openjpa/2.x folder.  The property would then be <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa:2.x" />.

           

          Contributions to the doc at https://docs.jboss.org/author/display/AS71/JPA+Reference+Guide are welcome for this. 

           

          Scott

          1 of 1 people found this helpful
          • 2. Re: Deploying JPA 2 (OpenJPA 2.1.0) on Jboss 7.1.0-Final-Snapshot
            sathwik.bp

            Hi Scott,

             

            Thanks for your explanation.

             

            Couple of questions,

            1) Does this mean that for multiple versions of a library one needs to create  slots under the module and use the slot which suits best for the application?

             

            2) How come the value "hibernate3-bundled" allows the application to host the required libraries. I would imagine that it should have been "org.hibernate:3"?

             

            regards,

            sathwik


            • 3. Re: Deploying JPA 2 (OpenJPA 2.1.0) on Jboss 7.1.0-Final-Snapshot
              smarlow

              1) Does this mean that for multiple versions of a library one needs to create  slots under the module and use the slot which suits best for the application? 

              Yes, more about modules is here.  You have the flexibility to determine your own naming scheme.  If you have additional questions about module/slots, you might want to create a new forum thread for that.

               

              2) How come the value "hibernate3-bundled" allows the application to host the required libraries. I would imagine that it should have been "org.hibernate:3"?

               

              Yes, that is a special name that is checked for internally (see code here), that is used for bundling the Hibernate 3.x jars with an application.  Specifying "org.hibernate:3" and a few other properties would of been equivalent.