Migrate to Hibernate 4.0.x
Recipe ID
io.moderne.hibernate.MigrateToHibernate40Artifactio.moderne.recipe:rewrite-hibernateThis recipe will apply changes commonly needed when migrating from Hibernate 3.x to 4.0.x, including migration of collection annotations to their JPA 2.0 equivalents.
Composite recipeProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe io.moderne.hibernate.MigrateToHibernate40If the recipe isn’t available locally, install it with:
mod config recipes jar install io.moderne.recipe:rewrite-hibernate:RELEASEDefinition
This recipe runs the following recipes in order.
- Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Change type
IndexColumntoOrderColumnorg.openrewrite.java.ChangeType - Change type
MapKeytoMapKeyColumnorg.openrewrite.java.ChangeType - Change annotation attribute name
@CollectionOfElements(targetElement)to@CollectionOfElements(targetClass)org.openrewrite.java.ChangeAnnotationAttributeName - Change type
CollectionOfElementstoElementCollectionorg.openrewrite.java.ChangeType - Migrate
@JoinTableto@CollectionTablefor element collectionsio.moderne.hibernate.update40.MigrateJoinTableToCollectionTable - Index HQL/JPQL positional parameters in method calls
org.hibernate.SharedSessionContract createQuery(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.hibernate.Session createQuery(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.hibernate.StatelessSession createQuery(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
jakarta.persistence.EntityManager createQuery(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
javax.persistence.EntityManager createQuery(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in annotations
@jakarta.persistence.NamedQueryio.moderne.hibernate.update40.IndexHqlAnnotationPositionalParameters - Index HQL/JPQL positional parameters in annotations
@javax.persistence.NamedQueryio.moderne.hibernate.update40.IndexHqlAnnotationPositionalParameters - Index HQL/JPQL positional parameters in annotations
@org.hibernate.annotations.NamedQueryio.moderne.hibernate.update40.IndexHqlAnnotationPositionalParameters - Index HQL/JPQL positional parameters in annotations
@org.springframework.data.jpa.repository.Queryio.moderne.hibernate.update40.IndexHqlAnnotationPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate5.HibernateTemplate find(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate5.HibernateTemplate bulkUpdate(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate5.HibernateTemplate findByNamedParam(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate5.HibernateTemplate findByValueBean(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate5.HibernateTemplate iterate(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate3.HibernateTemplate find(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Index HQL/JPQL positional parameters in method calls
org.springframework.orm.hibernate3.HibernateTemplate bulkUpdate(String,..)io.moderne.hibernate.update40.IndexHqlMethodPositionalParameters - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant - Replace constant with another constant
org.openrewrite.java.ReplaceConstantWithAnotherConstant
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats