-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
ClassCastException in JpaHibernateConnectionProvider with spring 5.3 #1034
Comments
+1 |
Probably related: java.lang.ClassCastException: class com.sun.proxy.$Proxy185 cannot be cast to class org.hibernate.engine.spi.SessionFactoryImplementor (com.sun.proxy.$Proxy185 and org.hibernate.engine.spi.SessionFactoryImplementor are in unnamed module of loader 'app') |
Unfortunately Also, the same problem with casting in the I'm using:
The workaround for me is:
I hope this would be useful for someone... 😃 |
Which version of Hibernate do you use? |
5.4.23.Final |
fixed in 5.14.0 |
Exception:
java.lang.ClassCastException: class com.sun.proxy.$Proxy113 cannot be cast to class org.hibernate.internal.SessionImpl (com.sun.proxy.$Proxy113 and org.hibernate.internal.SessionImpl are in unnamed module of loader 'app')
at org.javers.spring.jpa.JpaHibernateConnectionProvider.getConnection(JpaHibernateConnectionProvider.java:22)
Here
(SessionImpl)entityManager.unwrap(Session.class);
entityManager.unwrap(Session.class)
now returns Proxy instead of SessionImpl instance, because of changes in HibernateJpaVendorAdapter: entityManagerInterface changed from HibernateEntityManager (deprecated) to Session.Probable fix:
(SessionImpl)entityManager.unwrap(SessionImpl.class);
The text was updated successfully, but these errors were encountered: