4 Replies Latest reply on Feb 7, 2017 2:40 PM by Johannes Martin

    JBoss AS 7.5.0.Final (EAP 6.4.1) with Hibernate 5.0.9

    Johannes Martin Newbie



      I'm currently experimenting with JBoss AS 7.5.0.Final build from sources using instructions from Using a self build EAP binary in production. It works fine, but because of a problem in the bundled version of Hibernate (4.2.18) I need to use Hibernate 5.0.9 instead. I created a module for Hibernate which basically looks like the bundled module except for a slightly changed module.xml:

      <module xmlns="urn:jboss:module:1.1" name="org.hibernate" slot="5">


              <resource-root path="hibernate-core-5.0.9.Final.jar"/>

              <resource-root path="hibernate-entitymanager-5.0.9.Final.jar"/>

              <resource-root path="hibernate-infinispan-5.0.9.Final.jar"/>

              <!-- Insert resources here -->



      I changed my persistence.xml to use the Hibernate 5 persistence provider:

      <property name="jboss.as.jpa.providerModule" value="org.hibernate:5" />


      JBoss and my application start up fine, but when I try to access the database, I get an error:

           java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent data types: expected NUMBER, got BINARY


      The cause of this error is that Hibernate ignores all user type definitions (both direct using @Type on a column and indirect using @TypeDef on a package). By debugging I found out that this happens because even though my application gets to use the Hibernate 5 module (i.e. the runtime classes of the annotations are those within the hibernate 5 jars), it is the bundled Hibernate 4 module whose PersistenceUnitServiceImpl is run at deployment time. That one checks only for its own annotations which don't exist on the beans (they might have the same class name as those from Hibernate 5 but where loaded by a different class loader and are therefore not identical and so isAnnotationPresent() doesn't succeed).


      What do I have to do so JBoss uses the Hibernate 5 module during the deployment of the beans?


      Thanks a lot for your help.