db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject svn commit: r1686528 - in /db/jdo/trunk/api/src/java/javax/jdo: JDOQLTypedQuery.java JDOQLTypedSubquery.java
Date Sat, 20 Jun 2015 07:23:02 GMT
Author: andyj
Date: Sat Jun 20 07:23:01 2015
New Revision: 1686528

URL: http://svn.apache.org/r1686528
Log:
Clean up some methods to match Query

Modified:
    db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedQuery.java
    db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedSubquery.java

Modified: db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedQuery.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedQuery.java?rev=1686528&r1=1686527&r2=1686528&view=diff
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedQuery.java (original)
+++ db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedQuery.java Sat Jun 20 07:23:01 2015
@@ -16,6 +16,8 @@
  */
 package javax.jdo;
 
+import java.io.Closeable;
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -41,7 +43,7 @@ import javax.jdo.query.TimeExpression;
  * Designed to handle JDO query requirements as a whole.
  * @param <T> candidate type for this query
  */
-public interface JDOQLTypedQuery<T>
+public interface JDOQLTypedQuery<T> extends Serializable, Closeable
 {
     public static final String QUERY_CLASS_PREFIX = "Q";
 
@@ -139,13 +141,6 @@ public interface JDOQLTypedQuery<T>
     <V> Expression<V> variable(String name, Class<V> type);
 
     /**
-     * Whether the query should ignore the cache and go straight to the datastore.
-     * @param ignore Ignore the cache flag
-     * @return The query
-     */
-    JDOQLTypedQuery<T> setIgnoreCache(boolean ignore);
-
-    /**
      * Method to set the candidates to use over which we are querying.
      * If no candidates are set then the query is performed on the datastore.
      * @param candidates The candidates
@@ -194,6 +189,14 @@ public interface JDOQLTypedQuery<T>
     JDOQLTypedQuery<T> orderBy(OrderExpression<?>... orderExprs);
 
     /**
+     * Method to set the result of the query.
+     * @param distinct Whether results are distinct
+     * @param exprs The result expressions
+     * @return The query
+     */
+    JDOQLTypedQuery<T> result(boolean distinct, Expression<?>... exprs);
+
+    /**
      * Method to set the range of any required results, using expressions.
      * @param lowerInclExpr The position of the first result (inclusive)
      * @param upperExclExpr The position of the last result (exclusive)
@@ -236,7 +239,22 @@ public interface JDOQLTypedQuery<T>
     <S> JDOQLTypedSubquery<S> subquery(Class<S> candidate, String candidateAlias);
 
     /**
+     * Method to set the named parameters on this query prior to execution.
+     * @param namedParamMap The map of parameter values keyed by their names.
+     * @return This query
+     */
+    JDOQLTypedQuery<T> setParameters(Map namedParamMap);
+
+    /**
+     * Method to set the values of the numbered parameters on this query prior to execution.
+     * @param paramValues Values of the numbered parameters, in order.
+     * @return This query
+     */
+    JDOQLTypedQuery<T> setParameters(Object... paramValues);
+
+    /**
      * Method to set a parameter value for use when executing the query.
+     * TODO Drop this
      * @param paramExpr Parameter expression
      * @param value The value
      * @return The query
@@ -245,6 +263,7 @@ public interface JDOQLTypedQuery<T>
 
     /**
      * Method to set a parameter value for use when executing the query.
+     * TODO Drop this
      * @param paramName Parameter name
      * @param value The value
      * @return The query
@@ -253,34 +272,12 @@ public interface JDOQLTypedQuery<T>
 
     /**
      * Method to clear all parameter values.
+     * TODO Drop this
      * @return The query
      */
     JDOQLTypedQuery<T> clearParameters();
 
     /**
-     * Add a vendor-specific extension to this query. The key and value are not standard.
-     * An implementation must ignore keys that are not recognized.
-     * @param key the key of the extension
-     * @param value the value of the extension
-     * @return The query
-     */
-    JDOQLTypedQuery<T> addExtension (String key, Object value);
-
-    /**
-     * Set multiple extensions, or use null to clear all extensions. Map keys and values
are not standard.
-     * @param extensions the map of extensions
-     * @return The query
-     * @see #addExtension
-     */
-    JDOQLTypedQuery<T> setExtensions (Map<String, Object> extensions);
-
-
-
-    // Everything below here needs modification to fit in with JDO-652 and discussions on
QueryExecution
-    // TODO Do we put "boolean distinct, Expression<?>... exprs" in the execute() or
have a result(...) method?
-    // TODO Do we pass parameters into the execute method(s), and if so, as a Map, or array
or both variants?
-
-    /**
      * Method to execute the query where there are (potentially) multiple rows and we are
returning
      * the candidate type.
      * @return The results
@@ -297,59 +294,33 @@ public interface JDOQLTypedQuery<T>
      * Method to execute the query where there are (potentially) multiple rows and we are
returning either a
      * result type or the candidate type.
      * @param resultCls Result class
-     * @param distinct Whether to provide distinct results
-     * @param exprs Result expression(s)
      * @return The results
      * @param <R> result type
      */
-    <R> List<R> executeResultList(Class<R> resultCls, boolean distinct,
Expression<?>... exprs);
+    <R> List<R> executeResultList(Class<R> resultCls);
 
     /**
      * Method to execute the query where there is a single row and we are returning either
a result type
      * or the candidate type.
      * @param resultCls Result class
-     * @param distinct Whether to provide distinct results
-     * @param exprs Result expression(s)
      * @return The result
      * @param <R> result type
      */
-    <R> R executeResultUnique(Class<R> resultCls, boolean distinct, Expression<?>...
exprs);
-
-    /**
-     * Method to execute the query where there are (potentially) multiple rows and we have
a single result defined
-     * but no result class.
-     * @param distinct Whether to provide distinct results
-     * @param expr Result expression
-     * @return The results
-     */
-    List<Object> executeResultList(boolean distinct, Expression<?> expr);
-
-    /**
-     * Method to execute the query where there is a single row and we have a single result
defined
-     * but no result class.
-     * @param distinct Whether to provide distinct results
-     * @param expr Result expression
-     * @return The results
-     */
-    Object executeResultUnique(boolean distinct, Expression<?> expr);
+    <R> R executeResultUnique(Class<R> resultCls);
 
     /**
      * Method to execute the query where there are (potentially) multiple rows and we have
a result defined
      * but no result class.
-     * @param distinct Whether to provide distinct results
-     * @param exprs Result expression(s)
      * @return The results
      */
-    List<Object[]> executeResultList(boolean distinct, Expression<?>... exprs);
+    List<Object> executeResultList();
 
     /**
      * Method to execute the query where there is a single row and we have a result defined
      * but no result class.
-     * @param distinct Whether to provide distinct results
-     * @param exprs Result expression(s)
      * @return The results
      */
-    Object[] executeResultUnique(boolean distinct, Expression<?>... exprs);
+    Object executeResultUnique();
 
     /**
      * Method to execute the query deleting the affected instances.

Modified: db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedSubquery.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedSubquery.java?rev=1686528&r1=1686527&r2=1686528&view=diff
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedSubquery.java (original)
+++ db/jdo/trunk/api/src/java/javax/jdo/JDOQLTypedSubquery.java Sat Jun 20 07:23:01 2015
@@ -16,6 +16,8 @@
  */
 package javax.jdo;
 
+import java.io.Serializable;
+
 import javax.jdo.query.BooleanExpression;
 import javax.jdo.query.CharacterExpression;
 import javax.jdo.query.CollectionExpression;
@@ -34,7 +36,7 @@ import javax.jdo.query.TimeExpression;
  * 
  * @param <T> (Candidate) type being represented
  */
-public interface JDOQLTypedSubquery<T>
+public interface JDOQLTypedSubquery<T> extends Serializable
 {
     /**
      * Method to return an expression for the candidate of the subquery.



Mime
View raw message