IBM Support

Open JPA 500 Error : JPQL does not support conditional expression over embeddable class.

Troubleshooting


Problem

You receive an open JPA 500 Error : JPQL does not support conditional expression over embeddable class.

Symptom

Error 500: <openjpa-2.1.2-SNAPSHOT-r422266:1384519 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: An error occurred
while parsing the query filter 'SELECT e FROM Map e
where e.MapPK = :ProdCMapPK'.
Error message: JPQL query does not support conditional expression
over embeddable class. JPQL string: "ProdMapPK".

Cause

Incorrect JPQL placed in to open JPA entity used to select information from a database. The JPA 2.0 specification section 4.12 states the following:
"Comparisons over instances of embeddable class or map entry types are not supported."

Environment

Open JPA 2.0 and higher

Diagnosing The Problem

Look up conditional expressions and embeddable classes in the JPA specification.

Resolving The Problem

Change the select statement to:


SELECT e FROM Map e where e.MapPK.empName = :name and e.MapPK.empNumber=:number"

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java Persistence API (JPA)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5.5;8.0;7.0","Edition":"Base;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21623645