Commit latest changes by Linda DeMichiel
diff --git a/src/javax/persistence/criteria/AbstractQuery.java b/src/javax/persistence/criteria/AbstractQuery.java index 7f5390e..0bc7e01 100644 --- a/src/javax/persistence/criteria/AbstractQuery.java +++ b/src/javax/persistence/criteria/AbstractQuery.java
@@ -17,6 +17,7 @@ import java.util.List; import java.util.Set; +import javax.persistence.metamodel.EntityType; /** * The <code>AbstractQuery</code> interface defines functionality that is common @@ -32,7 +33,24 @@ * * @since Java Persistence 2.0 */ -public interface AbstractQuery<T> extends CommonAbstractQuery { +public interface AbstractQuery<T> { + + /** + * Create and add a query root corresponding to the given entity, + * forming a cartesian product with any existing roots. + * @param entityClass the entity class + * @return query root corresponding to the given entity + */ + <X> Root<X> from(Class<X> entityClass); + + /** + * Create and add a query root corresponding to the given entity, + * forming a cartesian product with any existing roots. + * @param entity metamodel entity representing the entity + * of type X + * @return query root corresponding to the given entity + */ + <X> Root<X> from(EntityType<X> entity); /** * Modify the query to restrict the query results according @@ -110,6 +128,13 @@ AbstractQuery<T> distinct(boolean distinct); /** + * Create a subquery of the query. + * @param type the subquery result type + * @return subquery + */ + <U> Subquery<U> subquery(Class<U> type); + + /** * Return the query roots. These are the roots that have * been defined for the <code>CriteriaQuery</code> or <code>Subquery</code> itself, * including any subquery roots defined as a result of @@ -127,6 +152,14 @@ Selection<T> getSelection(); /** + * Return the predicate that corresponds to the where clause + * restriction(s), or null if no restrictions have been + * specified. + * @return where clause predicate + */ + Predicate getRestriction(); + + /** * Return a list of the grouping expressions. Returns empty * list if no grouping expressions have been specified. * Modifications to the list do not affect the query.
diff --git a/src/javax/persistence/criteria/CriteriaDelete.java b/src/javax/persistence/criteria/CriteriaDelete.java index a064e9c..ba75d0a 100644 --- a/src/javax/persistence/criteria/CriteriaDelete.java +++ b/src/javax/persistence/criteria/CriteriaDelete.java
@@ -17,26 +17,27 @@ import javax.persistence.metamodel.EntityType; - /** - * The CriteriaDelete interface defines functionality for performing + * The <code>CriteriaDelete</code> interface defines functionality for performing * bulk delete operations using the Criteria API * * <p>Criteria API bulk delete operations map directly to database * delete operations. The persistence context is not synchronized * with the result of the bulk delete. * + * <p> A <code>CriteriaDelete</code> object must have a single root. + * * @param <T> the entity type that is the target of the delete * * @since Java Persistence 2.1 */ -public interface CriteriaDelete<T> extends CommonAbstractQuery { +public interface CriteriaDelete<T> { /** * Create and add a query root corresponding to the entity * that is the target of the delete. - * A CriteriaDelete object has a single root, the object that + * A <code>CriteriaDelete</code> object has a single root, the object that * is being deleted. * @param entityClass the entity class * @return query root corresponding to the given entity @@ -46,7 +47,7 @@ /** * Create and add a query root corresponding to the entity * that is the target of the delete. - * A CriteriaDelete object has a single root, the object that + * A <code>CriteriaDelete</code> object has a single root, the object that * is being deleted. * @param entity metamodel entity representing the entity * of type X @@ -81,4 +82,19 @@ */ CriteriaDelete<T> where(Predicate... restrictions); + /** + * Create a subquery of the query. + * @param type the subquery result type + * @return subquery + */ + <U> Subquery<U> subquery(Class<U> type); + + /** + * Return the predicate that corresponds to the where clause + * restriction(s), or null if no restrictions have been + * specified. + * @return where clause predicate + */ + Predicate getRestriction(); + }
diff --git a/src/javax/persistence/criteria/CriteriaUpdate.java b/src/javax/persistence/criteria/CriteriaUpdate.java index f818962..992be47 100644 --- a/src/javax/persistence/criteria/CriteriaUpdate.java +++ b/src/javax/persistence/criteria/CriteriaUpdate.java
@@ -19,7 +19,7 @@ import javax.persistence.metamodel.EntityType; /** - * The CriteriaUpdate interface defines functionality for performing + * The <code>CriteriaUpdate</code> interface defines functionality for performing * bulk update operations using the Criteria API. * * <p>Criteria API bulk update operations map directly to database update @@ -30,16 +30,18 @@ * The persistence context is not synchronized with the result of the * bulk update. * + * <p> A <code>CriteriaUpdate</code> object must have a single root. + * * @param <T> the entity type that is the target of the update * * @since Java Persistence 2.1 */ -public interface CriteriaUpdate<T> extends CommonAbstractQuery { +public interface CriteriaUpdate<T> { /** * Create and add a query root corresponding to the entity * that is the target of the update. - * A CriteriaUpdate object has a single root, the object that + * A <code>CriteriaUpdate</code> object has a single root, the object that * is being updated. * @param entityClass the entity class * @return query root corresponding to the given entity @@ -49,7 +51,7 @@ /** * Create and add a query root corresponding to the entity * that is the target of the update. - * A CriteriaUpdate object has a single root, the object that + * A <code>CriteriaUpdate</code> object has a single root, the object that * is being updated. * @param entity metamodel entity representing the entity * of type X @@ -124,4 +126,19 @@ */ CriteriaUpdate<T> where(Predicate... restrictions); + /** + * Create a subquery of the query. + * @param type the subquery result type + * @return subquery + */ + <U> Subquery<U> subquery(Class<U> type); + + /** + * Return the predicate that corresponds to the where clause + * restriction(s), or null if no restrictions have been + * specified. + * @return where clause predicate + */ + Predicate getRestriction(); + }