[ 
https://issues.apache.org/jira/browse/JDO-652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16605781#comment-16605781
 ] 

Andy Jefferson commented on JDO-652:
------------------------------------

See 
[https://github.com/datanucleus/javax.jdo/commit/34129e8c995db533545a1e882823edffd0a4c204]
  for a prototype of If-Else handling. This means that you can write such as 
the following


{{    JDOQLTypedQuery<Person> tq = pm.newJDOQLTypedQuery(Person.class);}}
{{    QPerson cand = QPerson.jdoCandidate;}}

{{    IfElseExpression<String> ageGroupExpr = 
tq.ifElseExpression(String.class);}}
{{    ageGroupExpr.ifThen(cand.age.lt(21), "Student");}}
{{    ageGroupExpr.ifThen(cand.age.ge(21).and(cand.age.lt(65)), "Worker");}}
{{    ageGroupExpr.elseEnd("Retired");}}
{{    tq.result(false, ageGroupExpr);}}

 

> Provision of a typesafe refactor-friendly query capability for JDOQL
> --------------------------------------------------------------------
>
>                 Key: JDO-652
>                 URL: https://issues.apache.org/jira/browse/JDO-652
>             Project: JDO
>          Issue Type: New Feature
>          Components: api, specification, tck
>            Reporter: Andy Jefferson
>            Assignee: Michael Bouschen
>            Priority: Major
>             Fix For: JDO 3.2
>
>         Attachments: JDO-652-api-patch-Andy.txt, JDO-652-patch3.txt, 
> typesafe.patch, typesafe_manifest.patch
>
>
> There are various querying capabilities of this type around. JPA2 has its 
> Criteria query API. Third party solutions like QueryDSL also exist, in its 
> case providing a JDOQL implementation (as well as JPQL, and HQL). We should 
> seriously consider introducing something along these lines in the JDO2.4 
> timeframe. 
> There is a comparison of JPA Criteria with QueryDSL over at 
> http://source.mysema.com/forum/mvnforum/viewthread_thread,49



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to