-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Shashi Kale opened SPR-7247 and commented
Hi,
I am using 3.0.1.RELEASE-A of spring along with Spring DM and am facing a similar issue.
My code goes like
Query q = em.createQuery("SELECT e FROM " + entityClazz.getSimpleName()
- " e");
I get
Caused by: java.lang.ClassCastException: $Proxy194 cannot be cast to javax.persistence.Query
at $Proxy56.createQuery(Unknown Source)
at com.arisglobal.aglite.dao.GenericCrudDAOImpl.findAll(GenericCrudDAOImpl.java:249)
at java.lang.Thread.run(Thread.java:619)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
Also,
if I make the method in my DAO transactional it works all fine. It doesn't work only if I make it non transactional.
Thanks and Regards,
Shashi
Affects: 3.0.1
Reference URL: https://jira.springsource.org/browse/SPR-6733?focusedCommentId=54096#action_54096
Issue Links:
- Spring 3.0 ORM with JPA 2.0 TypedQuery ClassCastException [SPR-6733] #11399 Spring 3.0 ORM with JPA 2.0 TypedQuery ClassCastException
Referenced from: commits 882289b