Migrate to Hibernate 7.0.x
Recipe ID
org.openrewrite.hibernate.MigrateToHibernate70Artifactorg.openrewrite.recipe:rewrite-hibernateThis recipe will apply changes commonly needed when migrating to Hibernate 7.0.x.
Composite recipeMSAL
Add to your build
Get a download tokenThis recipe is Moderne licensed, so the token must belong to a Moderne customer. It replaces YOUR_DOWNLOAD_TOKEN below.
~/.gradle/gradle.properties
codeGenomeUsername=you@example.com
codeGenomeToken=YOUR_DOWNLOAD_TOKEN
build.gradle.kts
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}
rewrite {
activeRecipe("org.openrewrite.hibernate.MigrateToHibernate70")
}
repositories {
mavenCentral()
maven {
url = uri("https://artifacts.codegenomeproject.org/maven")
credentials {
username = providers.gradleProperty("codeGenomeUsername").get()
password = providers.gradleProperty("codeGenomeToken").get()
}
}
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-hibernate:2.26.1")
}
Then run
./gradlew rewriteRunUsage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.hibernate.MigrateToHibernate70If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-hibernate:RELEASEDefinition
This recipe runs the following recipes in order.
- Migrate to Hibernate 6.6.x
org.openrewrite.hibernate.MigrateToHibernate66 - Migrate Hibernate Types to Hypersistence Utils for Hibernate 7.0
org.openrewrite.hibernate.MigrateToHypersistenceUtilsHibernate70 - Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Change Gradle or Maven dependency
org.hibernate.orm:hibernate-jpamodelgenorg.openrewrite.java.dependencies.ChangeDependency - Change type
AdditionalJaxbMappingProducertoAdditionalMappingContributororg.openrewrite.java.ChangeType - Change type
MetadataContributortoAdditionalMappingContributororg.openrewrite.java.ChangeType - Change type
SqmQualifiedJointoSqmJoinorg.openrewrite.java.ChangeType - Change method name
org.hibernate.Session save(Object)topersistorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session save(String, Object)topersistorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session delete(Object)toremoveorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session delete(String, Object)toremoveorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session get(Class, java.io.Serializable)tofindorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session get(String, java.io.Serializable)tofindorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session load(Class, java.io.Serializable)togetReferenceorg.openrewrite.java.ChangeMethodName - Change method name
org.hibernate.Session load(String, java.io.Serializable)togetReferenceorg.openrewrite.java.ChangeMethodName - 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