Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341074

Summary: CriteriaBuilder coalesce java.lang.ClassCastException when using literals
Product: z_Archived Reporter: Marc Nuri <marc>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: daniele.pirola, dazeydev.3, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Marc Nuri CLA 2011-03-28 05:15:37 EDT
When using the method coalesce with an Expression and a literal such as: 

criteriaBuilder.coalesce(root.get(attribute),0d) 

The following exception is thrown:
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)

Literals should be admitted in the coalesce method of CriteriaBuilder interface implementation.
Comment 1 Marc Nuri CLA 2011-03-28 05:18:05 EDT
As a workaround you can use:
criteriaBuilder.coalesce(root.get(attribute),criteriaBuilder.literal(0d))
Comment 2 Tom Ware CLA 2011-04-06 08:25:05 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 3 Daniele Pirola CLA 2014-07-31 08:39:22 EDT
News about this bug? Eclipse link project is dead?
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:26:35 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink