4.3.2. Migrate the Seam 2.2 JPA Example to JBoss EAP 6

Summary

The following task list summarizes the changes needed to successfully migrate the Seam 2.2 JPA example application to JBoss EAP 6. This example application can be found in the latest JBoss EAP 5 distribution under EAP5.x_HOME/jboss-eap-5.x/seam/examples/jpa/

Important

Applications that use Hibernate directly with Seam 2.2 may use a version of Hibernate 3 packaged inside the application. Hibernate 4, which is provided through the org.hibernate module of JBoss EAP 6, is not supported by Seam 2.2. This example is intended to help you get your application running on JBoss EAP 6 as a first step. Please be aware that packaging Hibernate 3 with a Seam 2.2 application is not a supported configuration.

Procedure 4.6. Migrate the Seam 2.2 JPA Example

  1. Remove the jboss-web.xml file

    Remove the jboss-web.xml file from the jboss-seam-jpa.war/WEB-INF/ directory. The class loading defined in the jboss-web.xml is now the default behavior.
  2. Modify the jboss-seam-jpa.jar/META-INF/persistence.xml file as follows.

    1. Remove or comment out the hibernate.cache.provider_class property in the jboss-seam-jpa.war/WEB-INF/classes/META-INF/persistence.xml file:
      <!-- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> -->
    2. Add the provider module property to the jboss-seam-booking.jar/META-INF/persistence.xml file:
      <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />
    3. Change the jta-data-source property to use the default JDBC datasource JNDI name:
      <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
  3. Add Seam 2.2 dependencies

    Copy the following JARs from the Seam 2.2 distribution library, SEAM_HOME/lib/, into the jboss-seam-jpa.war/WEB-INF/lib/ directory:
    • antlr.jar
    • slf4j-api.jar
    • slf4j-log4j12.jar
    • hibernate-entitymanager.jar
    • hibernate-core.jar
    • hibernate-annotations.jar
    • hibernate-commons-annotations.jar
    • hibernate-validator.jar
  4. Create a jboss-deployment-structure file to add remaining dependencies

    Create a jboss-deployment-structure.xml file in the jboss-seam-jpa.war/WEB-INF/ folder containing the following data:
    <jboss-deployment-structure>
       <deployment>
            <exclusions>
              <module name="javax.faces.api" slot="main"/>
              <module name="com.sun.jsf-impl" slot="main"/>
              <module name="org.hibernate" slot="main"/>
            </exclusions>
            <dependencies>
              <module name="org.apache.log4j" />
              <module name="org.dom4j" />
              <module name="org.apache.commons.logging" />
              <module name="org.apache.commons.collections" />
              <module name="javax.faces.api" slot="1.2"/>
              <module name="com.sun.jsf-impl" slot="1.2"/>
            </dependencies>
        </deployment>
    </jboss-deployment-structure>
Result:

The Seam 2.2 JPA example application deploys and runs successfully on JBoss EAP 6.