英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论