Check the Hibernate configuration

This rule flags hibernate.cfg.xml files, hibernate.properties files, and references to the org.hibernate.cfg.Configuration class so that you can verify that Hibernate is configured properly for WebSphere Application Server.

This rule detects Hibernate configuration properties that are known to require changes in WebSphere Application Server. If none of the specific properties are found, only the <hibernate-configuration> element is flagged. In this case, add the Hibernate jars to the application's class path. No other migration is expected.

This rule scans for the following Hibernate configuration properties that are known to require changes in WebSphere Application Server.

For the hibernate.connection.datasource and connection.datasource property, validate your JNDI lookups.

For the hibernate.transaction.factory_class, hibernate.transaction.manager_lookup_class, transaction.factory_class, transaction.manager_lookup_class, and jta.UserTransaction properties, the changes required depend on the transaction strategy being used in the application.

For container-managed transactions, set the properties to

<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.CMTTransactionFactory
</property>

<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>

For bean-managed transactions, set the properties to

<property name="hibernate.transaction.factory_class"> org.hibernate.transaction.JTATransactionFactory
</property>

<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>

<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>

There is also a related Java™ rule that checks for the use of the package org.hibernate in Java files.

When using Liberty, see

For WebSphere Application Server traditional, see