Skip to content

Spring ORM with JPA 2.0 and Eclipselink throws ClassCastException. [SPR-7247] #11906

@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits 882289b

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions