org.hibernate.criterion.Criterion ClassNotFoundException in migrating to Hibernate 6.1.6 with spring-orm 6.0.0

huangapple go评论58阅读模式
英文:

org.hibernate.criterion.Criterion ClassNotFoundException in migrating to Hibernate 6.1.6 with spring-orm 6.0.0

问题

我正在迁移一个使用spring-orm-6.x和Hibernate 6.1.6.Final版本的传统应用程序。
在运行应用程序时,在新的HibernateTemplate(session)处出现以下错误:

Caused by: java.lang.ClassNotFoundException: org.hibernate.criterion.Criterion
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
… 158 more

尝试查找此类时,似乎已从Hibernate 6.x版本中删除。只要我降级到Hibernate 5.x版本,这就能正常工作,并且可以创建HibernateTemplate对象,但我需要迁移到Hibernate 6.1.x版本,因为这是与Spring框架6.0兼容的版本。

我尝试查看构建路径相关的问题并删除了所有旧版本,但问题仍然存在。

英文:

I’m migrating a legacy application with spring-orm-6.x with Hibernate 6.1.6.Final version.
While running the application, the at new HibernateTemplate(session), following error is being thrown:

Caused by: java.lang.ClassNotFoundException: org.hibernate.criterion.Criterion
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
… 158 more

When tried to find this class, this looks to be removed from hibernate 6.x versions. As soon I downgrade to hibernate 5.x version this works fine and HibernateTemplate object gets created but I need to migrate to Hibernate 6.1.x version as this is the compatible version with spring framework 6.0.

I tried looking into build path related issues and removed all older versions but still issue persists.

答案1

得分: 0

只使用谷歌和迁移说明
https://thorben-janssen.com/migrating-to-hibernate-6/

英文:

just use google and migrating instructions
https://thorben-janssen.com/migrating-to-hibernate-6/

答案2

得分: 0

正确的解决方案是在旧代码中删除HibernateTemplate的使用,而改为使用Session API。

英文:

Correct solution was to remove HibernateTemplate usage and use Session API instead in legacy code.

huangapple
  • 本文由 发表于 2023年2月27日 14:21:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/75577299.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定