T
- result typepublic interface Fetchable<T>
Fetchable
defines default projection methods for Query
implementations.
All Querydsl query implementations should implement this interface.Modifier and Type | Method and Description |
---|---|
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. |
com.mysema.commons.lang.CloseableIterator<T> |
iterate()
Get the projection as a typed closeable Iterator
|
default java.util.stream.Stream<T> |
stream()
Get the projection as a typed closeable Stream.
|
java.util.List<T> fetch()
T fetchFirst()
T fetchOne() throws NonUniqueResultException
NonUniqueResultException
- if there is more than one matching resultcom.mysema.commons.lang.CloseableIterator<T> iterate()
default java.util.stream.Stream<T> stream()
QueryResults<T> fetchResults()
QueryResults
form.
Make sure to use 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 fetch()
instead if you do not need the total count of rows in the query result.fetch()
long fetchCount()
fetch().size()
.Copyright © 2007–2021 Querydsl. All rights reserved.