T
- result typeQ
- concrete subclasspublic abstract class AbstractJDOQuery<T,Q extends AbstractJDOQuery<T,Q>> extends FetchableSubQueryBase<T,Q> implements JDOQLQuery<T>
JDOQLQuery
interface.Modifier and Type | Field and Description |
---|---|
protected java.util.Set<java.lang.String> |
fetchGroups |
protected @Nullable java.lang.Integer |
maxFetchDepth |
MDC_PARAMETERS, MDC_QUERY, queryMixin
Constructor and Description |
---|
AbstractJDOQuery(@Nullable javax.jdo.PersistenceManager persistenceManager) |
AbstractJDOQuery(@Nullable javax.jdo.PersistenceManager persistenceManager,
JDOQLTemplates templates,
QueryMetadata metadata,
boolean detach) |
Modifier and Type | Method and Description |
---|---|
Q |
addFetchGroup(java.lang.String fetchGroupName)
Add the fetch group to the set of active fetch groups.
|
void |
close()
Close the query and related resources
|
java.util.List<T> |
fetch()
Get the projection as a typed List
|
long |
fetchCount()
Get the count of matched elements
Note: not all QueryDSL modules might optimize fetchCount using a count query.
|
T |
fetchOne()
Get the projection as a unique result or null if no result is found
|
QueryResults<T> |
fetchResults()
Get the projection in
QueryResults form. |
<U> Q |
from(CollectionExpression<?,U> path,
Path<U> alias)
Add query sources
|
Q |
from(EntityPath<?>... args)
Add query sources
|
JDOQLTemplates |
getTemplates() |
boolean |
isDetach() |
com.mysema.commons.lang.CloseableIterator<T> |
iterate()
Get the projection as a typed closeable Iterator
|
protected void |
logQuery(java.lang.String queryString,
java.util.Map<java.lang.Object,java.lang.String> parameters) |
Q |
setMaxFetchDepth(int depth)
Set the maximum fetch depth when fetching.
|
java.util.stream.Stream<T> |
stream()
Get the projection as a typed closeable Stream.
|
java.lang.String |
toString() |
accept, contains, contains, eq, eq, exists, getMetadata, getType, goe, goe, gt, gt, hashCode, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExists
equals, fetchFirst, transform, uniqueResult
distinct, groupBy, groupBy, having, having, limit, offset, orderBy, orderBy, restrict, set, where, where
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
clone
select, select, transform
fetchFirst
distinct, limit, offset, orderBy, restrict, set
where
contains, contains, eq, eq, exists, goe, goe, gt, gt, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExists
getMetadata
accept, getType
protected final java.util.Set<java.lang.String> fetchGroups
@Nullable protected @Nullable java.lang.Integer maxFetchDepth
public AbstractJDOQuery(@Nullable @Nullable javax.jdo.PersistenceManager persistenceManager)
public AbstractJDOQuery(@Nullable @Nullable javax.jdo.PersistenceManager persistenceManager, JDOQLTemplates templates, QueryMetadata metadata, boolean detach)
public Q addFetchGroup(java.lang.String fetchGroupName)
addFetchGroup
in interface JDOQLQuery<T>
fetchGroupName
- fetch group namepublic void close()
close
in interface JDOQLQuery<T>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public long fetchCount()
Fetchable
fetch().size()
.fetchCount
in interface Fetchable<T>
protected void logQuery(java.lang.String queryString, java.util.Map<java.lang.Object,java.lang.String> parameters)
public Q from(EntityPath<?>... args)
JDOQLQuery
from
in interface JDOQLQuery<T>
args
- sourcespublic <U> Q from(CollectionExpression<?,U> path, Path<U> alias)
JDOQLQuery
from
in interface JDOQLQuery<T>
path
- sourcealias
- aliaspublic JDOQLTemplates getTemplates()
public boolean isDetach()
public com.mysema.commons.lang.CloseableIterator<T> iterate()
Fetchable
public java.util.stream.Stream<T> stream()
Fetchable
public java.util.List<T> fetch()
Fetchable
fetch
in interface Fetchable<T>
fetch
in class FetchableQueryBase<T,Q extends AbstractJDOQuery<T,Q>>
public QueryResults<T> fetchResults()
Fetchable
QueryResults
form.
Make sure to use Fetchable.fetch()
instead if you do not rely on the QueryResults.getOffset()
or
QueryResults.getLimit()
, because it will be more performant. Also, count queries cannot be
properly generated for all dialects. For example: in JPA count queries can't be generated for queries
that have multiple group by expressions or a having clause.
Get the projection in QueryResults
form.
Use Fetchable.fetch()
instead if you do not need the total count of rows in the query result.fetchResults
in interface Fetchable<T>
Fetchable.fetch()
public Q setMaxFetchDepth(int depth)
JDOUserException
.
A value of -1 means that no limit is placed on fetching.
A positive integer will result in that number of references from the
initial object to be fetched.setMaxFetchDepth
in interface JDOQLQuery<T>
depth
- fetch depthpublic java.lang.String toString()
@Nullable public T fetchOne() throws NonUniqueResultException
Fetchable
fetchOne
in interface Fetchable<T>
NonUniqueResultException
- if there is more than one matching resultCopyright © 2007–2021 Querydsl. All rights reserved.