[jira] [Commented] (JDO-652) Provision of a typesafe refactor-friendly query capability for JDOQL

2019-03-10 Thread Michael Bouschen (JIRA)


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

Michael Bouschen commented on JDO-652:
--

I checked the LOG. The JDOQL string form is for a JDOQLTyped query is OK, it is 
the same as the JDOQL string based query. There is a difference in the result 
handling. The result class instance is created w/o an constructor argument:

{{20:36:19,590 (main) DEBUG [DataNucleus.Query] - ResultObject of type 
org.apache.jdo.tck.query.api.Michael$EmpWrapper created with following 
constructor arguments: []}}

Here is the corresponding output from the JDOQL string based query:

{{20:36:19,021 (main) DEBUG [DataNucleus.Query] - ResultObject of type 
org.apache.jdo.tck.query.api.Michael$EmpWrapper created with following 
constructor arguments: [FullTimeEmployee(2, L., Craig, born 22/Dec/1975, phone 
\{work=123456-2, home=}, hired 1/Jul/2003, weeklyhours 40.0, $5.0)]}}

> 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-ifTheElse.txt, JDO-652-api-patch-Andy.txt, 
> JDO-652-patch4.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)


[jira] [Comment Edited] (JDO-652) Provision of a typesafe refactor-friendly query capability for JDOQL

2019-03-10 Thread Andy Jefferson (JIRA)


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

Andy Jefferson edited comment on JDO-652 at 3/10/19 6:00 PM:
-

If you get problems then you need to look in the LOG. It will tell you what the 
equivalent JDOQL string form is for a JDOQLTyped query, and it will also have a 
block about "QueryCompilation". That should be the same as the equivalent JDOQL 
string based query. That is where your debug starts.

Then the log tells you the SQL invoked, for the single-string case and for the 
JDOQLTyped case. Should be the same if you have the same query.


was (Author: andy):
If you get problems then you need to look in the LOG. It will tell you what the 
equivalent JDOQL string form is for a JDOQLTyped query, and it will also have a 
block about "QueryCompilation". That should be the same as the equivalent JDOQL 
string based query. That is where your debug starts

> 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-ifTheElse.txt, JDO-652-api-patch-Andy.txt, 
> JDO-652-patch4.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)


[jira] [Commented] (JDO-652) Provision of a typesafe refactor-friendly query capability for JDOQL

2019-03-10 Thread Andy Jefferson (JIRA)


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

Andy Jefferson commented on JDO-652:


If you get problems then you need to look in the LOG. It will tell you what the 
equivalent JDOQL string form is for a JDOQLTyped query, and it will also have a 
block about "QueryCompilation". That should be the same as the equivalent JDOQL 
string based query. That is where your debug starts

> 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-ifTheElse.txt, JDO-652-api-patch-Andy.txt, 
> JDO-652-patch4.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)


[db-jdo] 01/01: JDO-778: Adding overloaded methods to JDOQLTypedQuery to create a correlated subquery

2019-03-10 Thread mbo
This is an automated email from the ASF dual-hosted git repository.

mbo pushed a commit to branch JDO-778
in repository https://gitbox.apache.org/repos/asf/db-jdo.git

commit 61f6793eb2f081a3cffd8d7cf97214b76f236cd9
Author: Michael Bouschen 
AuthorDate: Sun Mar 10 16:55:26 2019 +0100

JDO-778: Adding overloaded methods to JDOQLTypedQuery to create a 
correlated subquery
---
 api/src/main/java/javax/jdo/JDOQLTypedQuery.java | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/api/src/main/java/javax/jdo/JDOQLTypedQuery.java 
b/api/src/main/java/javax/jdo/JDOQLTypedQuery.java
index da04f38..9564374 100644
--- a/api/src/main/java/javax/jdo/JDOQLTypedQuery.java
+++ b/api/src/main/java/javax/jdo/JDOQLTypedQuery.java
@@ -343,11 +343,45 @@ public interface JDOQLTypedQuery extends Serializable, 
Closeable {
  * @param candidate Candidate for the subquery
  * @param candidateAlias Alias for the candidate
  * @return The subquery
- * @param  candidate type for subquery
+ * @param  Candidate type for subquery
  */
  JDOQLTypedSubquery subquery(Class candidate, String 
candidateAlias);
 
 /**
+ * Method to return a correlated subquery for use in this query.
+ * The candidate collection of the subquery is defined using a collection 
relationship of the outer query.
+ * To obtain the expression for the subquery to link it back to this 
query, call "result(...)" on the subquery.
+ * @param candidateCollection Expression defining the candidate collection 
for the subquery
+ * @param candidateAlias Alias for the candidate
+ * @return The subquery
+ * @param  Candidate type for subquery
+ */
+ JDOQLTypedSubquery subquery(CollectionExpression, E> 
candidateCollection, String candidateAlias);
+
+/**
+ * Method to return a correlated subquery for use in this query.
+ * The candidate collection of the subquery is defined using a list 
relationship of the outer query.
+ * To obtain the expression for the subquery to link it back to this 
query, call "result(...)" on the subquery.
+ * @param candidateList Expression defining the candidate collection for 
the subquery
+ * @param candidateAlias Alias for the candidate
+ * @return The subquery
+ * @param  Candidate type for subquery
+ */
+ JDOQLTypedSubquery subquery(ListExpression, E> 
candidateList, String candidateAlias);
+
+/**
+ * Method to return a correlated subquery for use in this query.
+ * The candidate collection of the subquery is defined using a map 
relationship of the outer query.
+ * To obtain the expression for the subquery to link it back to this 
query, call "result(...)" on the subquery.
+ * @param candidateMap Expression defining the candidate collection for 
the subquery
+ * @param candidateAlias Alias for the candidate
+ * @return The subquery
+ * @param  The key type of the map relationship
+ * @param  The value type the map relationship
+ */
+ JDOQLTypedSubquery> subquery(MapExpression, K, V> candidateMap, String candidateAlias);
+
+/**
  * Method to set the named parameters on this query prior to execution.
  * All parameter values specified in this method will only be retained 
until the subsequent query execution.
  * @param namedParamMap The map of parameter values keyed by their names.



[db-jdo] branch JDO-778 created (now 61f6793)

2019-03-10 Thread mbo
This is an automated email from the ASF dual-hosted git repository.

mbo pushed a change to branch JDO-778
in repository https://gitbox.apache.org/repos/asf/db-jdo.git.


  at 61f6793  JDO-778: Adding overloaded methods to JDOQLTypedQuery to 
create a correlated subquery

This branch includes the following new commits:

 new 61f6793  JDO-778: Adding overloaded methods to JDOQLTypedQuery to 
create a correlated subquery

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[jira] [Commented] (JDO-652) Provision of a typesafe refactor-friendly query capability for JDOQL

2019-03-10 Thread Michael Bouschen (JIRA)


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

Michael Bouschen commented on JDO-652:
--

Thanks Andy.

I switched to Datanucleus SNAPSHOT and both queries testQuery15f and 
testQuery16f compile. However they return an unexpected result. The result 
class instances are created. They should wrap the selected FullTimeEmplyoee 
instance, but instead the wrapped instance is null:

{{Wrong query result: }}
{{query: select into org.apache.jdo.tck.query.api.SampleQueries$EmpInfo from 
org.apache.jdo.tck.pc.company.FullTimeEmployee where salary > :sal}}
{{expected: java.util.ArrayList of size 3}}
{{[EmpInfo(worker:Michael), EmpInfo(worker:Craig), EmpInfo(worker:Tillmann)]}}
{{got:  java.util.ArrayList of size 3}}
{{[EmpInfo(worker:null), EmpInfo(worker:null), EmpInfo(worker:null)]}}

> 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-ifTheElse.txt, JDO-652-api-patch-Andy.txt, 
> JDO-652-patch4.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)


[db-jdo] branch JDO-652 updated: JDO-652: switch to Datanucleus SNAPSHOT version

2019-03-10 Thread mbo
This is an automated email from the ASF dual-hosted git repository.

mbo pushed a commit to branch JDO-652
in repository https://gitbox.apache.org/repos/asf/db-jdo.git


The following commit(s) were added to refs/heads/JDO-652 by this push:
 new 88f58bc  JDO-652: switch to Datanucleus SNAPSHOT version
88f58bc is described below

commit 88f58bc3c8c4e31dd91360d8db9069970bfd3259
Author: Michael Bouschen 
AuthorDate: Sun Mar 10 16:28:41 2019 +0100

JDO-652: switch to Datanucleus SNAPSHOT version
---
 tck/pom.xml| 10 +-
 .../main/java/org/apache/jdo/tck/query/api/SampleQueries.java  |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tck/pom.xml b/tck/pom.xml
index 99af680..af9ff56 100644
--- a/tck/pom.xml
+++ b/tck/pom.xml
@@ -143,27 +143,27 @@
 
 org.datanucleus
 datanucleus-core
-5.2.0-m3
+5.2.1-SNAPSHOT
 
 
 org.datanucleus
 datanucleus-rdbms
-5.2.0-m3
+5.2.1-SNAPSHOT
 
 
 org.datanucleus
 datanucleus-api-jdo
-5.2.0-m3
+5.2.1-SNAPSHOT
 
 
 org.datanucleus
 datanucleus-jdo-query
-5.0.9
+5.0.10-SNAPSHOT
 
 
 org.datanucleus
 datanucleus-api-jpa
-5.2.0-m2
+5.2.1-SNAPSHOT
 
 
 log4j
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleQueries.java 
b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleQueries.java
index acb2b77..fe3071e 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleQueries.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleQueries.java
@@ -2453,7 +2453,7 @@ public class SampleQueries extends QueryTest {
 List expected = testQuery16Helper();
 try (JDOQLTypedQuery q = 
pm.newJDOQLTypedQuery(FullTimeEmployee.class)) {
 QFullTimeEmployee cand = QFullTimeEmployee.candidate();
-q.result(true, cand);
+q.result(true, cand.as("FullTimeEmployee"));
 NumericExpression sal = q.numericParameter("sal", 
Double.class);
 q.filter(cand.salary.gt(sal));
 Map paramValues = new HashMap<>();
@@ -3014,7 +3014,7 @@ public class SampleQueries extends QueryTest {
 public String toString() {
 StringBuilder builder = new StringBuilder();
 builder.append("EmpInfo(");
-builder.append(", worker:").append(worker == null ? "null" : 
worker.getFirstname());
+builder.append("worker:").append(worker == null ? "null" : 
worker.getFirstname());
 builder.append(")");
 return builder.toString();
 }