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

Thanks for your reply James.

Bug logged ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=341074 Bug 341074
- CriteriaBuilder coalesce java.lang.ClassCastException when using literals
)


James Sutherland wrote:
> 
> 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
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-JPA-Criteria-Api--CriteriaBuilder-coalesce-java.lang.ClassCastException-tp31163588p31255996.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top