Switch to a different Hibernate ORM slot

In order to use a different module other than the default org.hibernate:main specify the identifier of the module you wish to use via the jboss.as.jpa.providerModule property in the persistence.xml file of your application, as in the following example.

Example 6. Using an alternative module slot of Hibernate ORM

  1. <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
  4. http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
  5. version="2.1" >
  6. <persistence-unit name="examplePu">
  7. <!-- ... -->
  8. <properties>
  9. <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.4"/>
  10. </properties>
  11. <!-- ... -->
  12. </persistence-unit>
  13. </persistence>

Needless to say, this will affect the classpath of your application: if your single application declares multiple persistence units, they should all make a consistent choice!

This property is documented in the WildFly JPA Reference Guide; you might want to check it out as it lists several other useful properties.