Home » Support » Issue Tracking » JPQL Case Statements (JPA 2.0)

JPQL Case Statements (JPA 2.0)

Type: Feature requestVersion: 1.4.0Priority: NormalStatus: ActiveReplies: 1
#1

JPQL 2.0 adds support of CASE statements for conditional expressions in queries, similarly to switch/case/default in Java, and based on the SQL syntax.

Case statements are currently not supported by ObjectDB.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#2

I wish to express also my interest in CASE statement support, which I need for conditional projection query results as described in  Pro JPA2 p.231 - 233. Could this please be prioritised.

EDIT: expanding. Need for cases like:

SELECT TYPE(e), e.id, e.name, TYPE(e.project), e.project.id, e.project.name, TYPE(e.owner), e.owner.id, e.owner.name FROM Element e

Projection query skips result row when project or owner null. Need CASE statement to check for when project or owner null and offer null projection query values in that case.

Results from the above query are used to construct a minimal Data Transfer Object (DTO) that is just enough to expose a named link (with id parameter) to the full view page of a fully loaded Element entity, and similarly links to the project or owner of an element, and class info. Experience shows this projection query approach is much faster than a query that loads full entities  - when only such links are needed (say in simple lists/tables) - even when most relationship fields of an entity are forced lazy.

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au

Post Reply

To post a reply and/or subscribe to update notifications - please login