Search code examples
hibernatewildflywildfly-8

Using classes from org.hibernate in WildFly


I'm migrating a Java EE application from GlassFish (4.0) to Wildfly (8.1.0 final). There is a requirement to use a native Hibernate package from hibernate-core (4.3.6 final) which is org.hibernate.annotations.Type. For example,

@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
private DateTime discountStartDate; //Getter and setter.

to use Joda-Time.

This type is however, not resolved. There is a compile-time error indicating this package does not exist.

I tried to add an explicit dependency to MANIFEST.MF in the ejb module as mentioned here but the package still does not resolve.

Do I need to package my own copy and add it as an external library to the ejb module? It should be expected to use the Hibernate jars included in server instead of adding them as external jars.


Solution

  • If you get a compile-time error, you'll have to add Hibernate to your compile-time classpath - with Maven, you would use scope provided.

    Adding the Hibernate dependency to MANIFEST.MF (or to jboss-deployment-structure.xml) only helps to resolve Hibernate classes at run-time.