Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] [JPA Criteria Api] CriteriaBuilder coalesce java.lang.ClassCastException

Yes, it should allow a literal, please log a bug for this and vote for it.



MarcNuri wrote:
> 
> Hello.
> When using the method coalesce with an Expression and a literal such as:
> 
> criteriaBuilder.coalesce(root.get(attribute),0d)
> 
> throws an exception:
> Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast
> to org.eclipse.persistence.internal.jpa.querydef.InternalSelection
>         at
> org.eclipse.persistence.internal.jpa.querydef.CriteriaBuilderImpl.coalesce(CriteriaBuilderImpl.java:2117)
> 
> As a workaround I use:
> criteriaBuilder.coalesce(root.get(attribute),criteriaBuilder.literal(0d))
> 
> From my understanding I think that the api supports coalesce with java
> objects directly. Am I wrong?
> 
> Regards
> --
> Marc Nuri
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/-JPA-Criteria-Api--CriteriaBuilder-coalesce-java.lang.ClassCastException-tp31163588p31229401.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top