Package com.querydsl.jpa.hibernate
Class AbstractHibernateQuery<T,Q extends AbstractHibernateQuery<T,Q>>
java.lang.Object
com.querydsl.core.support.QueryBase<Q>
com.querydsl.core.support.FetchableQueryBase<T,Q>
com.querydsl.core.support.FetchableSubQueryBase<T,Q>
com.querydsl.jpa.JPAQueryBase<T,Q>
com.querydsl.jpa.hibernate.AbstractHibernateQuery<T,Q>
- Type Parameters:
T- result typeQ- concrete subtype
- All Implemented Interfaces:
Fetchable<T>,FetchableQuery<T,,JPQLQuery<T>> FilteredClause<JPQLQuery<T>>,Query<JPQLQuery<T>>,SimpleQuery<JPQLQuery<T>>,ExtendedSubQuery<T>,Expression<T>,SubQueryExpression<T>,JPQLQuery<T>,Serializable
- Direct Known Subclasses:
HibernateQuery
public abstract class AbstractHibernateQuery<T,Q extends AbstractHibernateQuery<T,Q>>
extends JPAQueryBase<T,Q>
Abstract base class for Hibernate API based implementations of the JPQL interface
- Author:
- tiwe
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Nullable Booleanprotected @Nullable Stringprotected @Nullable Stringprotected intprotected @Nullable org.hibernate.FlushModeprotected @Nullable Booleanprotected intFields inherited from class com.querydsl.jpa.JPAQueryBase
queryMixinFields inherited from class com.querydsl.core.support.QueryBase
MDC_PARAMETERS, MDC_QUERY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractHibernateQuery(SessionHolder session, JPQLTemplates patterns, QueryMetadata metadata) AbstractHibernateQuery(org.hibernate.Session session) -
Method Summary
Modifier and TypeMethodDescriptionclone()Clone the state of this query to a new instanceprotected abstract Qclone(SessionHolder sessionHolder) clone(org.hibernate.Session session) Clone the state of this query to a new instance with the given Sessionclone(org.hibernate.StatelessSession session) Clone the state of this query to a new instance with the given StatelessSessionprotected voidorg.hibernate.query.QueryExpose the original Hibernate query for the given projectionprotected JPQLSerializerfetch()longfetchOne()com.mysema.commons.lang.CloseableIterator<T>iterate()Return the query results as anIterator.protected voidprotected voidreset()org.hibernate.ScrollableResultsscroll(org.hibernate.ScrollMode mode) Return the query results asScrollableResults.setCacheable(boolean cacheable) Enable caching of this query result set.setCacheRegion(String cacheRegion) Set the name of the cache region.setComment(String comment) Add a comment to the generated SQL.setFetchSize(int fetchSize) Set a fetchJoin size for the underlying JDBC query.setFlushMode(org.hibernate.FlushMode flushMode) Override the current session flush mode, just for this query.setLockMode(Path<?> path, org.hibernate.LockMode lockMode) Set the lock mode for the given path.setReadOnly(boolean readOnly) Entities retrieved by this query will be loaded in a read-only mode where Hibernate will never dirty-check them or make changes persistent.setTimeout(int timeout) Set a timeout for the underlying JDBC query.stream()Methods inherited from class com.querydsl.jpa.JPAQueryBase
fetchAll, fetchJoin, from, from, from, getTemplates, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, join, join, join, join, join, join, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, on, on, rightJoin, rightJoin, rightJoin, rightJoin, rightJoin, rightJoin, serialize, serialize, toStringMethods inherited from class com.querydsl.core.support.FetchableSubQueryBase
accept, contains, contains, eq, eq, exists, getMetadata, getType, goe, goe, gt, gt, hashCode, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExistsMethods inherited from class com.querydsl.core.support.FetchableQueryBase
equals, fetchFirst, transform, uniqueResultMethods inherited from class com.querydsl.core.support.QueryBase
distinct, groupBy, groupBy, having, having, limit, offset, orderBy, orderBy, restrict, set, where, whereMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.querydsl.core.types.Expression
accept, getTypeMethods inherited from interface com.querydsl.core.support.ExtendedSubQuery
contains, contains, eq, eq, exists, goe, goe, gt, gt, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExistsMethods inherited from interface com.querydsl.core.Fetchable
fetchFirstMethods inherited from interface com.querydsl.core.FetchableQuery
transformMethods inherited from interface com.querydsl.core.FilteredClause
whereMethods inherited from interface com.querydsl.core.SimpleQuery
distinct, limit, offset, orderBy, restrict, setMethods inherited from interface com.querydsl.core.types.SubQueryExpression
getMetadata
-
Field Details
-
cacheable
-
readOnly
-
cacheRegion
-
comment
-
fetchSize
protected int fetchSize -
lockModes
-
flushMode
@Nullable protected @Nullable org.hibernate.FlushMode flushMode -
timeout
protected int timeout
-
-
Constructor Details
-
AbstractHibernateQuery
public AbstractHibernateQuery(org.hibernate.Session session) -
AbstractHibernateQuery
public AbstractHibernateQuery(SessionHolder session, JPQLTemplates patterns, QueryMetadata metadata)
-
-
Method Details
-
fetchCount
public long fetchCount() -
createQuery
public org.hibernate.query.Query createQuery()Expose the original Hibernate query for the given projection- Returns:
- query
-
iterate
Return the query results as anIterator. If the query contains multiple results pre row, the results are returned in an instance ofObject[].
Entities returned as results are initialized on demand. The first SQL query returns identifiers only. -
stream
-
fetch
- Specified by:
fetchin interfaceFetchable<T>- Overrides:
fetchin classFetchableQueryBase<T,Q extends AbstractHibernateQuery<T, Q>>
-
fetchResults
-
logQuery
-
reset
protected void reset()- Specified by:
resetin classJPAQueryBase<T,Q extends AbstractHibernateQuery<T, Q>>
-
scroll
public org.hibernate.ScrollableResults scroll(org.hibernate.ScrollMode mode) Return the query results asScrollableResults. The scrollability of the returned results depends upon JDBC driver support for scrollableResultSets.- Parameters:
mode- scroll mode- Returns:
- scrollable results
-
setCacheable
Enable caching of this query result set.- Parameters:
cacheable- Should the query results be cacheable?
-
setCacheRegion
Set the name of the cache region.- Parameters:
cacheRegion- the name of a query cache region, ornullfor the default query cache
-
setComment
Add a comment to the generated SQL.- Parameters:
comment- comment- Returns:
- the current object
-
setFetchSize
Set a fetchJoin size for the underlying JDBC query.- Parameters:
fetchSize- the fetchJoin size- Returns:
- the current object
-
setLockMode
Set the lock mode for the given path.- Returns:
- the current object
-
setFlushMode
Override the current session flush mode, just for this query.- Returns:
- the current object
-
setReadOnly
Entities retrieved by this query will be loaded in a read-only mode where Hibernate will never dirty-check them or make changes persistent.- Returns:
- the current object
-
setTimeout
Set a timeout for the underlying JDBC query.- Parameters:
timeout- the timeout in seconds- Returns:
- the current object
-
fetchOne
- Throws:
NonUniqueResultException
-
createSerializer
- Specified by:
createSerializerin classJPAQueryBase<T,Q extends AbstractHibernateQuery<T, Q>>
-
clone
-
clone
-
clone
Clone the state of this query to a new instance with the given Session- Parameters:
session- session- Returns:
- cloned query
-
clone
Clone the state of this query to a new instance with the given StatelessSession- Parameters:
session- session- Returns:
- cloned query
-
clone
Clone the state of this query to a new instance- Specified by:
clonein classJPAQueryBase<T,Q extends AbstractHibernateQuery<T, Q>> - Returns:
- closed query
-