EclipseLink 2.4.0, build 'v20120308-r10963' API Reference

javax.persistence.criteria
Interface CommonAbstractQuery


public interface CommonAbstractQuery

The CommonAbstractQuery interface defines functionality that is common to both top-level queries and subqueries as well as to update and delete criteria operations. It is not intended to be used directly in query construction.

All queries must have: a set of root entities (which may in turn own joins).

All queries may have: a conjunction of restrictions.

Note that criteria queries and criteria update and delete operations are typed differently. Criteria queries are typed according to the query result type. Update and delete operations are typed according to the target of the update or delete.

Since:
Java Persistence 2.1

Method Summary
<X> Root<X>
from(java.lang.Class<X> entityClass)
          Create and add a query root corresponding to the given entity.
<X> Root<X>
from(EntityType<X> entity)
          Create and add a query root corresponding to the given entity,
 Predicate getRestriction()
          Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.
<U> Subquery<U>
subquery(java.lang.Class<U> type)
          Create a subquery of the query.
 CommonAbstractQuery where(Expression<java.lang.Boolean> restriction)
          Modify the query to restrict the query results according to the specified boolean expression.
 CommonAbstractQuery where(Predicate... restrictions)
          Modify the query to restrict the query results according to the conjunction of the specified restriction predicates.
 

Method Detail

from

<X> Root<X> from(java.lang.Class<X> entityClass)
Create and add a query root corresponding to the given entity.

Parameters:
entityClass - the entity class
Returns:
query root corresponding to the given entity

from

<X> Root<X> from(EntityType<X> entity)
Create and add a query root corresponding to the given entity,

Parameters:
entity - metamodel entity representing the entity of type X
Returns:
query root corresponding to the given entity

where

CommonAbstractQuery where(Expression<java.lang.Boolean> restriction)
Modify the query to restrict the query results according to the specified boolean expression. Replaces the previously added restriction(s), if any.

Parameters:
restriction - a simple or compound boolean expression
Returns:
the modified query

where

CommonAbstractQuery where(Predicate... restrictions)
Modify the query to restrict the query results according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.

Parameters:
restrictions - zero or more restriction predicates
Returns:
the modified query

subquery

<U> Subquery<U> subquery(java.lang.Class<U> type)
Create a subquery of the query.

Parameters:
type - the subquery result type
Returns:
subquery

getRestriction

Predicate getRestriction()
Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.

Returns:
where clause predicate

EclipseLink 2.4.0, build 'v20120308-r10963' API Reference