| JPA 2 Query casting throwing exception [message #644286] |
Fri, 10 December 2010 07:09  |
James Rawlings Messages: 2 Registered: December 2010 |
Junior Member |
|
|
Follwing the example from http:// wiki.eclipse.org/EclipseLink/Release/2.1.0/JPAQueryEnhanceme nts I am casting the query to a subclass using the criteria API Expression.as(type). When casting the result to a Path as per the the example I get a class cast exception.
Root<Employee> empRoot = cq1.from(getEntityManagerFactory().getMetamodel().entity(Employee.class));
Join<Employee, Project> join = empRoot.join("projects");
Path exp = ((Path)join.as(LargeProject.class)).get("budget");
exception thrown..
ClassCastException: Cannot cast org.hibernate.ejb.criteria.expression.function.CastFunction (id=113) to java.persistence.criteria.Path
Can anybody help? Many thanks.
[Updated on: Fri, 10 December 2010 09:26] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03762 seconds