AS 7.0.1 is released!!!
AS 7.0.1 is released, which includes improvements for using different persistence providers (beside the included Hibernate 4.0.0). The framework is in place to plug in Hibernate 3.5 (or greater) persistence providers. This addressed user feedback, that its important to use Hibernate 3.x on AS7, to give more time before migrating to Hibernate 4.0.0. Switching your application to Hibernate 4.x, should be done as soon as possible. Hibernate 4.0.0 has been modified to support the AS7 modular classloading environment and JBoss logging (and other many other improvements).
Drop in a Hibernate 3.6.6.Final module
By default, JPA applications will use Hibernate 4.0.0 with AS7, unless you add property jboss.as.jpa.providerModule set to org.hibernate:3 to your persistence.xml properties list. You also need to create an org.hibernate:3 module that represents the Hibernate 3.6.6.Final release jars that will be used by your application. I downloaded the hibernate-distribution-3.6.6.Final for creating the new module.
Steps to create the Hibernate 3.6.6.Final module
- Create as/modules/org/hibernate/3 folder
- Copy jars from the hibernate-distribution-3.6.6.Final folder into the as/modules/org/hibernate/3 folder
- Create as/modules/org/hibernate/3/module.xml file
- update your persistence.xml to use the org.hibernate:3 module
<!-- as/modules/org/hibernate/3/module.xml file --> <?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.0" name="org.hibernate" slot="3"> <resources> <resource-root path="hibernate3.jar"/> <resource-root path="javassist-3.12.0.GA.jar"/> <resource-root path="antlr-2.7.6.jar"/> <resource-root path="commons-collections.jar"/> <resource-root path="dom4j-1.6.1.jar"/> <!-- Insert other Hibernate 3 jars to be used here --> </resources> <dependencies> <module name="org.jboss.as.jpa.hibernate" slot="3"/> <module name="asm.asm"/> <module name="javax.api"/> <module name="javax.persistence.api"/> <module name="javax.transaction.api"/> <module name="javax.validation.api"/> <module name="org.apache.ant"/> <module name="org.infinispan"/> <module name="org.javassist"/> <module name="org.slf4j"/> </dependencies> </module>
<!-- persistence.xml using Hibernate 3.6.6.Final --> <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="GameOfThrones_pu"> <description>my Hibernate 3 persistence unit.</description> <jta-data-source>java:jboss/datasources/gameDS</jta-data-source> <properties> <property name="jboss.as.jpa.providerModule" value="org.hibernate:3"/> </properties> </persistence-unit> </persistence>
Example of an AS7 (Arquillian) unit test using the org.hibernate:3 module. Note that this test is @Ignored until we arrange for the org.hibernate:3 module to be created by the test build.
I could of created a standalone application but I prefer to push the awesome Arquillian project! ;) I hope that you will contribute similar JPA tests to the AS7 project when you can.
Experimental use of OGM on AS 7.0.1
cd work git clone git://github.com/hibernate/hibernate-ogm.git Cloning into hibernate-ogm... remote: Counting objects: 4371, done. remote: Compressing objects: 100% (1357/1357), done. remote: Total 4371 (delta 1694), reused 4262 (delta 1599) Receiving objects: 100% (4371/4371), 1.17 MiB, done. Resolving deltas: 100% (1694/1694), done. cd hibernate-ogm mvn clean install ... lots of output from building ogm jars.... Folder hibernate-ogm-core/target will contain hibernate-ogm-core-3.0.0-SNAPSHOT.jar
cd .. git clone git://github.com/scottmarlow/jboss-as.git cd jboss-as git checkout ogm ./build.sh clean install OR build.bat clean install
- Follow instructions above for creating the org.hibernate:3 module
- Create as/modules/org/hibernate/ogm folder
- Copy hibernate-ogm-core-3.0.0-SNAPSHOT.jar that you just built (from OGM build) into the as/modules/org/hibernate/ogm folder
- Create as/modules/org/hibernate/ogm/module.xml file
- update your persistence.xml to use the org.hibernate:3 module and org.hibernate:ogm providerModule.
- Create a local-only infinispan.xml for your application.
Or to run the OGM unit test that I added (after manually creating the org.hibernate:ogm module), run the unit test with these steps:
- cd testsuite
- cd compat
- mvn clean install -DallTests
The unit test will run one instance of AS7 and use Infinispan in local-only mode. A few entities will be created (under a JTA transaction) and read back. If you see error
org.jboss.as.testsuite.compat.jpa.hibernate.OGMHibernate3SharedModuleProviderTestCase: Could not deploy to container, open the ./target/jbossas/standalone/log/server.log to see what went wrong (did you create the as/modules/org/hibernate/3 and as/modules/org/hibernate/ogm modules?)
Like I said before, using OGM on AS7, is experimental at this point. ;)
AS 7.0.1 JPA documentation
I started a new git repo for working on EclipseLink integration. This will require coordination with the EclipseLink project as changes are probably required there as well. EclipseLink has the eclipselink.target.server property that can be set to JBoss but that doesn't support AS7 yet. Also, we need to fix the PersistenceUnitMetadata.getNewTempClassLoader() in AS7. Depending on the level of interest, the EclipseLink integration in AS7 will come together (more of the work may be inside of the EclipeLink project itself).
Community contributions are welcome
Please continue to ask/answer questions on the AS7 user discussion forums. I would like to work with a few more community members on further code changes to the JPA integration support in AS7. If you would like to volunteer, find Scott Marlow on IRC (irc://irc.freenode.org/jboss-as7). As well as working on integration support with other persistence providers.