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

Hi team

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. Please help on this asap.

Hi @Karuna_Sahu ,

the Hibernate Criteria API has been removed in Hibernate 6.0, see migration guide

Yes, but spring-orm 6.x HibernateTemplate class still refers to the removed classes. Hence throwing error.

You should report this to the Spring team then.