db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [db-jdo] 01/01: JDO-778: Adding overloaded methods to JDOQLTypedQuery to create a correlated subquery
Date Wed, 18 Dec 2019 20:23:08 GMT
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 8de135e1bc9a4aa8841fd1ee0df59d3b724a1c2b
Author: Michael Bouschen <mbo@apache.org>
AuthorDate: Wed Dec 18 21:22:35 2019 +0100

    JDO-778: Adding overloaded methods to JDOQLTypedQuery to create a correlated subquery
---
 api/src/main/java/javax/jdo/JDOQLTypedQuery.java            | 13 ++++++++-----
 tck/pom.xml                                                 |  2 +-
 .../java/org/apache/jdo/tck/query/api/SampleQueries.java    |  4 +---
 tck/src/main/resources/conf/jdo-signatures.txt              |  6 +++---
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/api/src/main/java/javax/jdo/JDOQLTypedQuery.java b/api/src/main/java/javax/jdo/JDOQLTypedQuery.java
index 9564374..19381b9 100644
--- a/api/src/main/java/javax/jdo/JDOQLTypedQuery.java
+++ b/api/src/main/java/javax/jdo/JDOQLTypedQuery.java
@@ -352,34 +352,37 @@ public interface JDOQLTypedQuery<T> extends Serializable, Closeable
{
      * 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 candidate Candidate for the subquery
      * @param candidateAlias Alias for the candidate
      * @return The subquery
      * @param <E> Candidate type for subquery
      */
-    <E> JDOQLTypedSubquery<E> subquery(CollectionExpression<Collection<E>,
E> candidateCollection, String candidateAlias);
+    <E> JDOQLTypedSubquery<E> subquery(CollectionExpression<Collection<E>,
E> candidateCollection, Class<E> candidate, 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 candidateList Expression defining the candidate list for the subquery
+     * @param candidate Candidate for the subquery
      * @param candidateAlias Alias for the candidate
      * @return The subquery
      * @param <E> Candidate type for subquery
      */
-    <E> JDOQLTypedSubquery<E> subquery(ListExpression<List<E>, E>
candidateList, String candidateAlias);
+    <E> JDOQLTypedSubquery<E> subquery(ListExpression<List<E>, E>
candidateList, Class<E> candidate, 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 candidateMap Expression defining the candidate map for the subquery
+     * @param candidate Candidate for the subquery
      * @param candidateAlias Alias for the candidate
      * @return The subquery
      * @param <K> The key type of the map relationship
      * @param <V> The value type the map relationship
      */
-    <K, V> JDOQLTypedSubquery<Map.Entry<K, V>> subquery(MapExpression<Map<K,
V>, K, V> candidateMap, String candidateAlias);
+    <K, V> JDOQLTypedSubquery<Map.Entry<K, V>> subquery(MapExpression<Map<K,
V>, K, V> candidateMap, Class<Map.Entry<K, V>> candidate, String candidateAlias);
 
     /**
      * Method to set the named parameters on this query prior to execution.
diff --git a/tck/pom.xml b/tck/pom.xml
index 0e1cd50..155134f 100644
--- a/tck/pom.xml
+++ b/tck/pom.xml
@@ -153,7 +153,7 @@
                 <dependency>
                     <groupId>org.datanucleus</groupId>
                     <artifactId>datanucleus-api-jdo</artifactId>
-                    <version>5.2.2-SNAPSHOT</version>
+                    <version>5.2.3-SNAPSHOT</version>
                 </dependency>
                 <dependency>
                     <groupId>org.datanucleus</groupId>
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 2e08ee7..35ae3f6 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
@@ -2816,7 +2816,6 @@ public class SampleQueries extends QueryTest {
      * subquery is the collection of employees in the department of the candidate employee
      * and the parameter passed to the subquery is the manager of the candidate employee.
      */
-    /* subquery method not yet implemented by datanucleus
     public void testQuery19f() {
         Transaction tx = pm.currentTransaction();
         try {
@@ -2824,7 +2823,7 @@ public class SampleQueries extends QueryTest {
             List<String> expected = Arrays.asList("Michael");
             try (JDOQLTypedQuery<Employee> q = pm.newJDOQLTypedQuery(Employee.class))
{
                 QEmployee cand = QEmployee.candidate();
-                JDOQLTypedSubquery<Employee> subquery = q.subquery(cand.department.employees,
"e");
+                JDOQLTypedSubquery<Employee> subquery = q.subquery(cand.department.employees,
Employee.class,"e");
                 QEmployee candsub = QEmployee.candidate("e");
                 subquery.filter(candsub.manager.eq(cand.manager));
                 q.result(false, cand.firstname)
@@ -2841,7 +2840,6 @@ public class SampleQueries extends QueryTest {
             }
         }
     }
-    */
 
     /**
      * Deleting Multiple Instances.
diff --git a/tck/src/main/resources/conf/jdo-signatures.txt b/tck/src/main/resources/conf/jdo-signatures.txt
index fc11750..cf3399a 100644
--- a/tck/src/main/resources/conf/jdo-signatures.txt
+++ b/tck/src/main/resources/conf/jdo-signatures.txt
@@ -1746,9 +1746,9 @@ public interface javax.jdo.JDOQLTypedQuery extends java.io.Serializable,
java.io
     abstract javax.jdo.JDOQLTypedQuery range(javax.jdo.query.Expression paramLowerInclExpr,
javax.jdo.query.Expression paramUpperExclExpr);
     abstract javax.jdo.JDOQLTypedSubquery subquery(String candidateAlias);
     abstract javax.jdo.JDOQLTypedSubquery subquery(Class candidate, String candidateAlias);
-    abstract javax.jdo.JDOQLTypedSubquery subquery(javax.jdo.query.CollectionExpression candidateCollection,
String candidateAlias);
-    abstract javax.jdo.JDOQLTypedSubquery subquery(javax.jdo.query.ListExpression candidateList,
String candidateAlias);
-    abstract javax.jdo.JDOQLTypedSubquery subquery(javax.jdo.query.MapExpression candidateMap,
String candidateAlias);
+    abstract javax.jdo.JDOQLTypedSubquery subquery(javax.jdo.query.CollectionExpression candidateCollection,
Class candidate , String candidateAlias);
+    abstract javax.jdo.JDOQLTypedSubquery subquery(javax.jdo.query.ListExpression candidateList,
Class candidate , String candidateAlias);
+    abstract javax.jdo.JDOQLTypedSubquery subquery(javax.jdo.query.MapExpression candidateMap,
Class candidate , String candidateAlias);
     abstract javax.jdo.JDOQLTypedQuery setParameters(java.util.Map namedParamMap);
     abstract javax.jdo.JDOQLTypedQuery setParameter(javax.jdo.query.Expression paramExpr,
Object value);
     abstract javax.jdo.JDOQLTypedQuery setParameter(String paramName, Object value);


Mime
View raw message