Hibernate to WebSphere JPA - Java rules
The Hibernate to WebSphere JPA Java rules are located under the Java Code Review > Framework migration category of rules. These rules provide information on how to migrate commonly used Hibernate interfaces and methods. You must manually migrate your Hibernate code to WebSphere JPA. For migration guidance, use the information and samples in the detailed help for each rule.
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| Do not use Hibernate packages | This rule detects the use of Hibernate package references that are not covered by other rules. | No |
| Do not use the Hibernate Configuration buildSessionFactory method | This rule flags the org.hibernate.cfg.Configuration buildSessionFactory method. Use the javax.persistence.Persistence createEntityManagerFactory method instead. | No |
| Do not use the Hibernate Query getNamedParameters method | This rule flags the org.hibernate.Query getNamedParameters method. Use the javax.persistence.Query getParameters method instead. | No |
| Do not use the Hibernate Query list method | This rule flags the org.hibernate.Query list method. Use the javax.persistence.Query getResultList method instead. | No |
| Do not use the Hibernate Query methods to set parameters | This rule flags org.hibernate.Query set-parameter methods. Use the javax.persistence.Query setParameter method instead. | No |
| Do not use the Hibernate Query setParameterList or setParameters methods | This rule flags the org.hibernate.Query setParameterList and setParameters methods. Use the javax.persistence.Query setParameter method instead. | No |
| Do not use the Hibernate Query uniqueResult method | This rule flags the org.hibernate.Query uniqueResult method. Use the javax.persistence.Query getSingleResult method instead. | No |
| Do not use the Hibernate Session beginTransaction method | This rule flags the org.hibernate.Session beginTransaction method. Use the javax.persistence.EntityManager getTransaction method followed by a call to javax.persistence.EntityTransaction begin method instead. | No |
| Do not use the Hibernate Session createCriteria method | This rule flags the org.hibernate.Session createCriteria method. Use the javax.persistence.EntityManager getCriteriaBuilder method followed by a call to the javax.persistence.criteria.CriteriaBuilder createQuery method. | No |
| Do not use the Hibernate Session createQuery method | This rule flags the org.hibernate.Session createQuery method. Use the javax.persistence.EntityManager createQuery method instead. | No |
| Do not use the Hibernate Session createSQLQuery method | This rule flags the org.hibernate.Session createSQLQuery method. Use the javax.persistence.EntityManager createNativeQuery method instead. | No |
| Do not use the Hibernate Session delete method | This rule flags the org.hibernate.Session delete method. Use the javax.persistence.EntityManager remove method instead. | No |
| Do not use the Hibernate SessionFactory interface | This rule flags uses of the org.hibernate.SessionFactory interface. Use the javax.persistence.EntityManagerFactory interface instead. | No |
| Do not use the Hibernate SessionFactory isClosed method | This rule flags the org.hibernate.SessionFactory isClosed method. Use the javax.persistence.EntityManagerFactory isOpen method instead. | No |
| Do not use the Hibernate SessionFactory openSession method | This rule flags the org.hibernate.SessionFactory openSession method. Use the javax.persistence.EntityManagerFactory createEntityManger method instead. | No |
| Do not use the Hibernate Session getNamedQuery method | This rule flags the org.hibernate.Session getNamedQuery method. Use the javax.persistence.EntityManager createNamedQuery method instead. | No |
| Do not use the Hibernate Session getSessionFactory method | This rule flags the org.hibernate.Session getSessionFactory method. Use the javax.persistence.EntityManager getEntityManagerFactory method instead. | No |
| Do not use the Hibernate Session interface | This rule flags the org.hibernate.Session interface. Use the javax.persistence.EntityManager interface instead. | No |
| Do not use the Hibernate Session load method | This rule flags the org.hibernate.Session load method. Use the javax.persistence.EntityManager find method instead. | No |
| Do not use the Hibernate Session save method | This rule flags the org.hibernate.Session save method. Use the javax.persistence.EntityManager persist method instead. | No |
| Do not use the Hibernate Session saveOrUpdate method | This rule flags the org.hibernate.Session saveOrUpdate method. Use the javax.persistence.EntityManager merge method instead. | No |
| Do not use the Hibernate Session update method | This rule flags the org.hibernate.Session update method. Use the javax.persistence.EntityManager merge method instead. | No |
| Do not use the Hibernate Transaction interface | This rule flags uses of the org.hibernate.Transaction interface, org.hibernate.JDBCTransaction class, and org.hibernate.JTATransaction class. Replace the use of the Transaction interface and the JDBCTransaction class with the javax.persistence.EntityTransaction interface. Replace the use of the JTATransaction class with the javax.transaction.UserTransaction interface. | No |
| Migrate HQL FROM clause used as a query |
This rule detects and migrates Hibernate Query Language (HQL) strings that begin with a
FROM
clause. In JPA, query strings must begin with a
SELECT
clause.
|
No |
| Migrate HQL ORDER BY UPPER/LOWER clauses |
This rule detects Hibernate Query Language (HQL) strings that contain
ORDER BY
UPPER
or
ORDER BY LOWER
clauses that must be migrated for use with JPA.
|
No |