[
https://issues.apache.org/jira/browse/JDO-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14279271#comment-14279271
]
Michael Bouschen commented on JDO-650:
--------------------------------------
We should align with the restrictions that are imposed by JPA for the CASE.
But I think using relationships in a CASE is supported by JPA. A
simple_arithmetic_expression or a string_primary etc may be a
state_field_path_expression and this may navigate through a relationship as
long as it ends in a state field (that is not a relationship). So the
corresponding query should be legal in JPA:
SELECT FROM org.apache.jdo.tck.pc.company.Employee
WHERE (IF (this.manager == null) this.mentor.department.depid
ELSE this.manager.department.deptid) == this.department.deptid
I expect the above query results in the same SQL as you added to your comment.
Yes, the SQL looks a little complicated. But I think it works and returns the
expected result.
What do you think?
> Support for conditional operator ? : in JDOQL
> ---------------------------------------------
>
> Key: JDO-650
> URL: https://issues.apache.org/jira/browse/JDO-650
> Project: JDO
> Issue Type: New Feature
> Components: specification, tck
> Affects Versions: JDO 2 maintenance release 2 (2.2)
> Reporter: Michael Bouschen
> Assignee: Michael Bouschen
> Fix For: JDO 3.1
>
>
> JDOQL should support the Java conditional operator ? :, e.g. salary >= 1000.0
> ? salary : salary * 1.1
> The conditional operator can be mapped to the CASE-expression in SQL: CASE
> WHEN condition THEN thenExpr ELSE elseExpr END. Are there any issues with
> non-SQL datastores when supporting the conditional operator?
> Another question: which part of a JDOQL query can include a conditional
> expression? I propose the query filter, the having clause and the result
> specification.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)