org.datanucleus.jpa.criteria
Class SubqueryImpl<T>

java.lang.Object
  extended by org.datanucleus.jpa.criteria.ExpressionImpl<T>
      extended by org.datanucleus.jpa.criteria.SubqueryImpl<T>
All Implemented Interfaces:
javax.persistence.criteria.AbstractQuery<T>, javax.persistence.criteria.Expression<T>, javax.persistence.criteria.Selection<T>, javax.persistence.criteria.Subquery<T>, javax.persistence.TupleElement<T>

public class SubqueryImpl<T>
extends ExpressionImpl<T>
implements javax.persistence.criteria.Subquery<T>

Implementation of JPA2 Criteria "Subquery". A subquery in DataNucleus is represented as a variable (as it is in JDOQL), consequently this expression is backed by a VariableExpression.


Field Summary
protected  CriteriaQueryImpl<T> delegate
           
protected  CriteriaQueryImpl<?> parent
           
static java.util.Random random
          Random number generator, for use in naming subqueries
 
Constructor Summary
SubqueryImpl(java.lang.Class<T> type, javax.persistence.criteria.CriteriaQuery<?> query)
           
 
Method Summary
<X,Y> javax.persistence.criteria.CollectionJoin<X,Y>
correlate(javax.persistence.criteria.CollectionJoin<X,Y> arg0)
           
<X,Y> javax.persistence.criteria.Join<X,Y>
correlate(javax.persistence.criteria.Join<X,Y> arg0)
           
<X,Y> javax.persistence.criteria.ListJoin<X,Y>
correlate(javax.persistence.criteria.ListJoin<X,Y> arg0)
           
<X,K,V> javax.persistence.criteria.MapJoin<X,K,V>
correlate(javax.persistence.criteria.MapJoin<X,K,V> arg0)
           
<Y> javax.persistence.criteria.Root<Y>
correlate(javax.persistence.criteria.Root<Y> arg0)
           
<X,Y> javax.persistence.criteria.SetJoin<X,Y>
correlate(javax.persistence.criteria.SetJoin<X,Y> arg0)
           
 javax.persistence.criteria.Subquery<T> distinct(boolean flag)
           
<X> javax.persistence.criteria.Root<X>
from(java.lang.Class<X> cls)
           
<X> javax.persistence.criteria.Root<X>
from(javax.persistence.metamodel.EntityType<X> type)
           
 java.util.Set<javax.persistence.criteria.Join<?,?>> getCorrelatedJoins()
           
 javax.persistence.criteria.CriteriaQuery<?> getDelegate()
          Convenience accessor for the delegate criteria query that provides this subquery.
 java.util.List<javax.persistence.criteria.Expression<?>> getGroupList()
           
 javax.persistence.criteria.Predicate getGroupRestriction()
           
 java.util.Set<javax.persistence.criteria.Join<?,?>> getJoins()
           
 javax.persistence.criteria.AbstractQuery<?> getParent()
           
 javax.persistence.criteria.Predicate getRestriction()
           
 java.lang.Class<T> getResultType()
           
 java.util.Set<javax.persistence.criteria.Root<?>> getRoots()
           
 javax.persistence.criteria.Expression<T> getSelection()
           
 javax.persistence.criteria.Subquery<T> groupBy(javax.persistence.criteria.Expression<?>... exprs)
           
 javax.persistence.criteria.Subquery<T> groupBy(java.util.List<javax.persistence.criteria.Expression<?>> exprs)
           
 javax.persistence.criteria.Subquery<T> having(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
           
 javax.persistence.criteria.Subquery<T> having(javax.persistence.criteria.Predicate... exprs)
           
 boolean isDistinct()
           
 javax.persistence.criteria.Subquery<T> select(javax.persistence.criteria.Expression<T> expr)
           
<U> javax.persistence.criteria.Subquery<U>
subquery(java.lang.Class<U> type)
           
 java.lang.String toString()
          Method to print out the expression as it would appear in JPQL single-string form.
 javax.persistence.criteria.Subquery<T> where(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
           
 javax.persistence.criteria.Subquery<T> where(javax.persistence.criteria.Predicate... exprs)
           
 
Methods inherited from class org.datanucleus.jpa.criteria.ExpressionImpl
alias, as, getAlias, getCompoundSelectionItems, getJavaType, getQueryExpression, in, in, in, in, isCompoundSelection, isNotNull, isNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.persistence.criteria.Expression
as, in, in, in, in, isNotNull, isNull
 
Methods inherited from interface javax.persistence.criteria.Selection
alias, getCompoundSelectionItems, isCompoundSelection
 
Methods inherited from interface javax.persistence.TupleElement
getAlias, getJavaType
 

Field Detail

parent

protected CriteriaQueryImpl<?> parent

delegate

protected CriteriaQueryImpl<T> delegate

random

public static java.util.Random random
Random number generator, for use in naming subqueries

Constructor Detail

SubqueryImpl

public SubqueryImpl(java.lang.Class<T> type,
                    javax.persistence.criteria.CriteriaQuery<?> query)
Method Detail

getCorrelatedJoins

public java.util.Set<javax.persistence.criteria.Join<?,?>> getCorrelatedJoins()
Specified by:
getCorrelatedJoins in interface javax.persistence.criteria.Subquery<T>

getParent

public javax.persistence.criteria.AbstractQuery<?> getParent()
Specified by:
getParent in interface javax.persistence.criteria.Subquery<T>

getDelegate

public javax.persistence.criteria.CriteriaQuery<?> getDelegate()
Convenience accessor for the delegate criteria query that provides this subquery.

Returns:
The delegate

correlate

public <X,Y> javax.persistence.criteria.CollectionJoin<X,Y> correlate(javax.persistence.criteria.CollectionJoin<X,Y> arg0)
Specified by:
correlate in interface javax.persistence.criteria.Subquery<T>

correlate

public <X,Y> javax.persistence.criteria.Join<X,Y> correlate(javax.persistence.criteria.Join<X,Y> arg0)
Specified by:
correlate in interface javax.persistence.criteria.Subquery<T>

correlate

public <X,Y> javax.persistence.criteria.ListJoin<X,Y> correlate(javax.persistence.criteria.ListJoin<X,Y> arg0)
Specified by:
correlate in interface javax.persistence.criteria.Subquery<T>

correlate

public <X,K,V> javax.persistence.criteria.MapJoin<X,K,V> correlate(javax.persistence.criteria.MapJoin<X,K,V> arg0)
Specified by:
correlate in interface javax.persistence.criteria.Subquery<T>

correlate

public <Y> javax.persistence.criteria.Root<Y> correlate(javax.persistence.criteria.Root<Y> arg0)
Specified by:
correlate in interface javax.persistence.criteria.Subquery<T>

correlate

public <X,Y> javax.persistence.criteria.SetJoin<X,Y> correlate(javax.persistence.criteria.SetJoin<X,Y> arg0)
Specified by:
correlate in interface javax.persistence.criteria.Subquery<T>

getJoins

public java.util.Set<javax.persistence.criteria.Join<?,?>> getJoins()

distinct

public javax.persistence.criteria.Subquery<T> distinct(boolean flag)
Specified by:
distinct in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
distinct in interface javax.persistence.criteria.Subquery<T>

isDistinct

public boolean isDistinct()
Specified by:
isDistinct in interface javax.persistence.criteria.AbstractQuery<T>

getResultType

public java.lang.Class<T> getResultType()
Specified by:
getResultType in interface javax.persistence.criteria.AbstractQuery<T>

select

public javax.persistence.criteria.Subquery<T> select(javax.persistence.criteria.Expression<T> expr)
Specified by:
select in interface javax.persistence.criteria.Subquery<T>

getSelection

public javax.persistence.criteria.Expression<T> getSelection()
Specified by:
getSelection in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
getSelection in interface javax.persistence.criteria.Subquery<T>

from

public <X> javax.persistence.criteria.Root<X> from(java.lang.Class<X> cls)
Specified by:
from in interface javax.persistence.criteria.AbstractQuery<T>

from

public <X> javax.persistence.criteria.Root<X> from(javax.persistence.metamodel.EntityType<X> type)
Specified by:
from in interface javax.persistence.criteria.AbstractQuery<T>

getRestriction

public javax.persistence.criteria.Predicate getRestriction()
Specified by:
getRestriction in interface javax.persistence.criteria.AbstractQuery<T>

getRoots

public java.util.Set<javax.persistence.criteria.Root<?>> getRoots()
Specified by:
getRoots in interface javax.persistence.criteria.AbstractQuery<T>

where

public javax.persistence.criteria.Subquery<T> where(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
Specified by:
where in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
where in interface javax.persistence.criteria.Subquery<T>

where

public javax.persistence.criteria.Subquery<T> where(javax.persistence.criteria.Predicate... exprs)
Specified by:
where in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
where in interface javax.persistence.criteria.Subquery<T>

groupBy

public javax.persistence.criteria.Subquery<T> groupBy(javax.persistence.criteria.Expression<?>... exprs)
Specified by:
groupBy in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
groupBy in interface javax.persistence.criteria.Subquery<T>

groupBy

public javax.persistence.criteria.Subquery<T> groupBy(java.util.List<javax.persistence.criteria.Expression<?>> exprs)
Specified by:
groupBy in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
groupBy in interface javax.persistence.criteria.Subquery<T>

getGroupList

public java.util.List<javax.persistence.criteria.Expression<?>> getGroupList()
Specified by:
getGroupList in interface javax.persistence.criteria.AbstractQuery<T>

getGroupRestriction

public javax.persistence.criteria.Predicate getGroupRestriction()
Specified by:
getGroupRestriction in interface javax.persistence.criteria.AbstractQuery<T>

having

public javax.persistence.criteria.Subquery<T> having(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
Specified by:
having in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
having in interface javax.persistence.criteria.Subquery<T>

having

public javax.persistence.criteria.Subquery<T> having(javax.persistence.criteria.Predicate... exprs)
Specified by:
having in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
having in interface javax.persistence.criteria.Subquery<T>

subquery

public <U> javax.persistence.criteria.Subquery<U> subquery(java.lang.Class<U> type)
Specified by:
subquery in interface javax.persistence.criteria.AbstractQuery<T>

toString

public java.lang.String toString()
Description copied from class: ExpressionImpl
Method to print out the expression as it would appear in JPQL single-string form.

Overrides:
toString in class ExpressionImpl<T>
Returns:
The JPQL single string form of this expression


Copyright © 2011. All Rights Reserved.