openrewrite / rewrite-hibernate

OpenRewrite recipes for Hibernate ORM.
Apache License 2.0
5 stars 7 forks source link

Add a recipe to migrate to Hypersistence for Hibernate 6.3 #22

Closed mikomatic closed 6 months ago

mikomatic commented 6 months ago

What problem are you trying to solve?

There is an existing recipe to migrate to Hibernate 6.2.

This migration handles migration of the dependency io.hypersistence:hypersistence-utils-hibernate-60 to io.hypersistence:hypersistence-utils-hibernate-62

In order to migrate to Hibernate 6.3, a new recipe could handle the migration from io.hypersistence:hypersistence-utils-hibernate-62 to io.hypersistence:hypersistence-utils-hibernate-63, (see installation guide )

What precondition(s) should be checked before applying this recipe?

This migration should probably depend on org.openrewrite.hibernate.MigrateToHibernate62

Describe the situation before applying the recipe

<?xml version="1.0" encoding="UTF-8"?>
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>io.hypersistence</groupId>
            <artifactId>hypersistence-utils-hibernate-62</artifactId>
            <version>3.7.3</version>
        </dependency>
    </dependencies>
</project>

Describe the situation after applying the recipe

<?xml version="1.0" encoding="UTF-8"?>
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>io.hypersistence</groupId>
            <artifactId>hypersistence-utils-hibernate-63</artifactId>
            <version>3.7.3</version>
        </dependency>
    </dependencies>
</project>

Have you considered any alternatives or workarounds?

No

Any additional context

This recipe could later be used in the org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2 recipe

Are you interested in contributing this recipe to OpenRewrite?

Yes, i could do a PR if that is Ok, this seems like a simple recipe that relies only on org.openrewrite.java.dependencies.ChangeDependency

timtebeek commented 6 months ago

Fixed in

Thanks again @mikomatic ! I've renamed this issue to show the limited scope; if there's any other steps for a Hibernate 6.3 migration we can open new tickets to outline and fix those.