Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error: 'package org.hibernate.criterion does not exist' after using Hibernate recipe for 6.x #30

Open
mathewm3 opened this issue Jul 8, 2024 · 1 comment
Labels
question Further information is requested recipe

Comments

@mathewm3
Copy link

mathewm3 commented Jul 8, 2024

What version of OpenRewrite are you using?

I am using

  • rewrite-maven-plugin 5.35.0
  • rewrite-hibernate 1.8.0
  • recipe org.openrewrite.hibernate.MigrateToHibernate62

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>5.35.0</version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.hibernate.MigrateToHibernate62</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-hibernate</artifactId>
                        <version>1.8.0</version>
                    </dependency>
                </dependencies>
            </plugin>

What is the smallest, simplest way to reproduce the problem?

import org.hibernate.criterion.Criterion;

What did you expect to see?

the package org.hibernate.criterion.* is removed from hibernate 6. 

No modification was made. The removed packages should be deleted and replacement code should available.
https://github.com/hibernate/hibernate-orm/blob/6.0/migration-guide.adoc#legacy-hibernate-criteria-api

What did you see instead?

import org.hibernate.criterion.Criterion;

pom.xml changes were done

            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.6.15.Final</version>

changed to

            <groupId>org.hibernate.orm</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>6.2.28.Final</version>

pom.xml file changes from 5.6.15.Final to 6.2.28.Final

What is the full stack trace of any errors you encountered?

NA

Are you interested in contributing a fix to OpenRewrite?

NA

@mathewm3 mathewm3 added the bug Something isn't working label Jul 8, 2024
@timtebeek
Copy link
Contributor

Hi @mathewm3 ; when you say "the replacement code should available", could you give an example? I haven't used Hibernate in a while, and the link you gave only says

The legacy Hibernate Criteria API which was deprecated back in Hibernate 5.x and removed in 6.0. Usually, all queries using the legacy API can be modeled with the JPA Criteria API. In some cases it is necessary to use the Hibernate JPA Criteria extensions.

I notice you've logged this as a bug, whereas we have a slightly different template that might help recipe development for recipe requests:
https://github.com/openrewrite/rewrite-hibernate/issues/new?assignees=&labels=recipe&projects=&template=recipe_request.md&title=

If you could provide such before/after examples then we'd be in a better shape to suggest how to develop such a recipe.

@timtebeek timtebeek added the question Further information is requested label Jul 8, 2024
@timtebeek timtebeek added recipe and removed bug Something isn't working labels Aug 9, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested recipe
Projects
Status: Backlog
Development

No branches or pull requests

2 participants