Migrate to Hibernate 7.0.x
ProprietaryThis recipe will apply changes commonly needed when migrating to Hibernate 7.0.x.
io. moderne. hibernate. MigrateToHibernate70mod run . --recipe= io. moderne. hibernate. MigrateToHibernate70Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Migrate to Hibernate 6.6.x
- Migrate to Hibernate 7.0.x
- Migrate
jackson-datatype-hibernate6tojackson-datatype-hibernate7 - Change Gradle or Maven dependency
io.hypersistence:hypersistence-utils-hibernate-63 - Remove a Gradle or Maven dependency
org.hibernate.common:hibernate-commons-annotations - Add Gradle or Maven dependency
org.hibernate.orm:hibernate-core:7.0.x - Remove a Gradle or Maven dependency
org.hibernate:hibernate-proxool - Remove a Gradle or Maven dependency
org.hibernate:hibernate-vibur - Remove annotation
@org.hibernate.annotations.GeneratorType - Remove annotation
@org.hibernate.annotations.LazyToOne - Remove annotation
@org.hibernate.annotations.Loader - Remove annotation
@org.hibernate.annotations.Persister - Remove annotation
@org.hibernate.annotations.Proxy - Remove annotation
@org.hibernate.annotations.SelectBeforeUpdate - Migrate
@JdbcTypeand legacy@Typeto@JdbcTypeCode - Migrate Session interface method calls
- Migrate Session save/update/delete method calls
- Migrate NaturalIdLoadAccess method calls
- Migrate NaturalIdMultiLoadAccess method calls
- Replace hibernate annotations with Jakarta variants
- Migrate to @TargetEmbeddable
- Migrate implicit cascade=PERSIST for @Id and @MapsId associations
- Replace Session.buildLockRequest with LockOptions
- Migrate LockOptions to direct parameters
- Null safe Transaction#getTimeout()
- Change type
MetamodeltoJpaMetamodel - Change type
SqmQualifiedJointoSqmJoin - Change type
org.hibernate.query.BindableTypetoorg.hibernate.type.BindableType - Change type
org.hibernate.query.OutputableTypetoorg.hibernate.type.OutputableType - Change type
org.hibernate.query.spi.BindingContexttoorg.hibernate.type.BindingContext - Change method name
jakarta.persistence.criteria.Expression as(Class)tocast - Remove unnecessary cast to
SessionforSessionFactory.createEntityManager() - Migrate
setFlushMode()tosetQueryFlushMode() - Remove leaking of SharedSessionContractImplementor from
org.hibernate.usertype.UserTypeinvocations - Remove leaking of SharedSessionContractImplementor from
org.hibernate.usertype.UserTypeimplementations - Remove leaking of SessionFactoryImplementor from
org.hibernate.usertype.CompositeUserTypeinvocations and implementations - Migrate
MetamodelImplementorto Hibernate 7.0 - Migrate
Configurable.configure()to useGeneratorCreationContext - Migrate Hibernate
Integrator#integratemethod - Migrate JPQL
trunc()tocast(... as date) - Migrate @Query to @NativeQuery for unsupported JPQL
- Find native queries with enum parameters requiring SpEL conversion
- Migrate to Hibernate 7 JFR APIs