Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341074 - CriteriaBuilder coalesce java.lang.ClassCastException when using literals
Summary: CriteriaBuilder coalesce java.lang.ClassCastException when using literals
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P2 normal with 7 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-28 05:15 EDT by Marc Nuri CLA
Modified: 2022-06-09 10:26 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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