konveyor / rulesets

Collections of static code analysis rules
Apache License 2.0
1 stars 25 forks source link

Create rules for migration to Hibernate ORM 5.6.x #143

Open jmle opened 1 month ago

jmle commented 1 month ago

According to the migration guide:

Due to the Jakarta EE migration, make sure to upgrade to Hibernate ORM 5.6.x with the hibernate-core-jakarta artifact, alongside switching your javax.persistence imports to jakarta.persistence (Jakarta EE 9). Alternatively, consider migrating to Hibernate ORM 6.1 right away (exclusively based on jakarta.persistence, compatible with EE 9 as well as EE 10) which is the Hibernate version that Spring Boot 3.0 comes with.

Investigate and create rules if necessary.

In the rule description and message, try to be as verbose and clear as possible. Code examples are always welcome and useful. Feel free to use markdown syntax for these.

konveyor-ci-bot[bot] commented 1 month ago

This issue is currently awaiting triage. If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance. The triage/accepted label can be added by org members.

jmle commented 3 weeks ago

If using hibernate 5.6.x, the only change needed is to import

<dependency>
    <groupId>org.hibernate.orm</groupId>
    <artifactId>hibernate-core-jakarta</artifactId>
    <version>5.6.15.Final</version> <!-- Make sure it's a 5.6.x version compatible with Jakarta -->
</dependency>

instead.

If using lower hibernate versions (Spring 5 is compatible with 5.0 upwards), a migration to 5.6 must be done first, in order to be able to use hibernate-core-jakarta.

Another rule can be done to switch the namespaces, in case it is not covered by the jakarta namespace rules that we already have.