Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA 2 Query casting throwing exception(JPA Criteria API)
JPA 2 Query casting throwing exception [message #644286] Fri, 10 December 2010 12:09 Go to next message
James Rawlings is currently offline James RawlingsFriend
Messages: 2
Registered: December 2010
Junior Member
Follwing the example from http:// nts I am casting the query to a subclass using the criteria API 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)"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 14:26]

Report message to a moderator

Re: JPA 2 Query casting throwing exception [message #644334 is a reply to message #644286] Fri, 10 December 2010 15:20 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member

The error states you are using Hibernate as your JPA provider.
You need to use EclipseLink as the provider to get EclipseLink features. ie
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
in your persistence.xml with the EclipseLink jar on your classpath. see

Previous Topic:BigDecimal correctly persisted but not correctly loaded
Next Topic:TableGenerator Sequencing options
Goto Forum:

Current Time: Sat Jul 24 14:54:41 GMT 2021

Powered by FUDForum. Page generated in 0.01315 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top