APAR status
Closed as program error.
Error description
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.CriteriaBuilderImp l.coalesce(CriteriaBuilderImpl.java:2117) ´´´
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: All users of IBM WebSphere Application * * Server - Java Persistence API - JPA 2.1 & * * EclipseLink * **************************************************************** * PROBLEM DESCRIPTION: EclipseLink throws a * * ClassCastException when using * * literals in CriteriaBuilder Coalesce * * expressions * **************************************************************** * RECOMMENDATION: * **************************************************************** When using a CriteriaBuilder coalesce expression with literal values, EclipseLink throws an exception as it attempts to cast the literal object to an internal object type. Example: ´´´ CriteriaQuery<Object[]> criteriaQuery = builder.createQuery(Object[].class); Root<CoalesceEntity> root = criteriaQuery.from(CoalesceEntity.class); Subquery<Long> countQuery = criteriaQuery.subquery(Long.class); Root<CoalesceEntity> countRoot = countQuery.from(CoalesceEntity.class); countQuery.select(builder.count(countRoot)); // Pass the literal value directly Expression<Long> coalesceExp = builder.coalesce(countQuery, 0L); criteriaQuery.select( builder.array( root.get("description"), coalesceExp)); ´´´ Example 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.CriteriaBuilderImp l.coalesce(CriteriaBuilderImpl.java:2117) ´´´
Problem conclusion
The fix for this APAR changes the EclipseLink implementation and involves an update to the third-party source. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=341074 This fix is currently targeted for WebSphere Application Server 9.0.5.9. For more information, see 'Recommended Updates for WebSphere Application Server': https://www.ibm.com/support/pages/node/715553
Temporary fix
Comments
APAR Information
APAR number
PH37833
Reported component name
WEBSPHERE APP S
Reported component ID
5724J0800
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2021-06-03
Closed date
2021-07-12
Last modified date
2021-07-12
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
WEBSPHERE APP S
Fixed component ID
5724J0800
Applicable component levels
R900 PSY
UP
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
02 November 2021