You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I guess I found the root of the problem: If an extended vendor interface is not visible in your bundle ClassLoader, we'll exclude that entire interface - even if it derives from javax.persistence.Query, which we're then missing unless it is being implemented separately as well. I've fixed this through introspecting parent interfaces in 3.0.3 now.
This will be available in tonight's 3.0.3 snapshot. Would be great if you could give it an early try...
I would like to apply the patch to the 3.0.1.RELEASE-A version and test since we have dependency on many spring bundles and can't change quickly to 3.0.3 Snapshot. I will apply the changes to ClassUtils class and test. Would that be fine?
I have applied the patch on 3.0.1.RELEASE-A and my use case where the exception was being thrown works fine now. I will keep testing this further and keep posted.
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()
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:
Referenced from: commits 882289b
The text was updated successfully, but these errors were encountered: