201 words

Issue #13 - JPQL Case Statements (JPA 2.0)

JPA FeatureVersion: 1.04Priority: NormalStatus: ActiveReplies: 1
2010-05-14 11:30

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)
support's picture
Joined on 2010-05-03
User Post #14
2012-07-10 06:16

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
webel's picture
Joined on 2011-05-27
User Post #57

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB