org.hibernate.criterion.Criterion ClassNotFoundException in migrating to Hibernate 6.1.6 with spring-orm 6.0.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 (BuiltinClassLoader.java:641)
at (ClassLoaders.java:188)
at (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.

2 Answers

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

just use google and migrating instructions

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like