T
- result typeQ
- concrete query typepublic class UnionImpl<T,Q extends ProjectableSQLQuery<T,Q> & Query<Q>> extends java.lang.Object implements Union<T>
Modifier and Type | Method and Description |
---|---|
<R,C> R |
accept(Visitor<R,C> v,
C context)
Accept the visitor with the given context
|
Expression<T> |
as(Path<T> alias)
Create an alias for the expression
|
Expression<T> |
as(java.lang.String alias)
Create an alias for the expression
|
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 |
fetchFirst()
Get the first result of Get the projection or null if no result is found
|
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. |
QueryMetadata |
getMetadata()
Get the query metadata for the subquery
|
java.lang.Class<? extends T> |
getType()
Get the java type for this expression
|
Union<T> |
groupBy(Expression<?>... o)
Defines the grouping/aggregation expressions
|
Union<T> |
having(Predicate... o)
Defines the filters for aggregation
|
com.mysema.commons.lang.CloseableIterator<T> |
iterate()
Get the projection as a typed Iterator
|
java.util.List<T> |
list()
Get the projection as a typed List
|
Union<T> |
orderBy(OrderSpecifier<?>... o)
Define the ordering of the query results
|
java.util.stream.Stream<T> |
stream()
Get the projection as a typed closeable Stream.
|
java.lang.String |
toString() |
public UnionImpl(Q query)
public java.util.List<T> list()
Union
public java.util.List<T> fetch()
Fetchable
public T fetchFirst()
Fetchable
fetchFirst
in interface Fetchable<T>
public T fetchOne() throws NonUniqueResultException
Fetchable
fetchOne
in interface Fetchable<T>
NonUniqueResultException
- if there is more than one matching resultpublic com.mysema.commons.lang.CloseableIterator<T> iterate()
Union
public java.util.stream.Stream<T> stream()
Fetchable
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 long fetchCount()
Fetchable
fetch().size()
.fetchCount
in interface Fetchable<T>
public Union<T> groupBy(Expression<?>... o)
Union
public Union<T> having(Predicate... o)
Union
public Union<T> orderBy(OrderSpecifier<?>... o)
Union
public Expression<T> as(java.lang.String alias)
Union
public Expression<T> as(Path<T> alias)
Union
public java.lang.String toString()
toString
in class java.lang.Object
@Nullable public <R,C> R accept(Visitor<R,C> v, @Nullable C context)
Expression
accept
in interface Expression<T>
R
- return typeC
- context typev
- visitorcontext
- context of visitpublic java.lang.Class<? extends T> getType()
Expression
getType
in interface Expression<T>
public QueryMetadata getMetadata()
SubQueryExpression
getMetadata
in interface SubQueryExpression<T>
Copyright © 2007–2021 Querydsl. All rights reserved.