Package com.querydsl.sql
Class AbstractSQLQuery<T,Q extends AbstractSQLQuery<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.sql.ProjectableSQLQuery<T,Q>
com.querydsl.sql.AbstractSQLQuery<T,Q>
- Type Parameters:
T- result typeQ- concrete subtype
- All Implemented Interfaces:
Fetchable<T>,FetchableQuery<T,,Q> FilteredClause<Q>,Query<Q>,SimpleQuery<Q>,ExtendedSubQuery<T>,Expression<T>,SubQueryExpression<T>,SQLCommonQuery<Q>,Serializable
- Direct Known Subclasses:
AbstractMySQLQuery,AbstractOracleQuery,AbstractPostgreSQLQuery,AbstractSQLServerQuery,AbstractTeradataQuery,SQLQuery
public abstract class AbstractSQLQuery<T,Q extends AbstractSQLQuery<T,Q>>
extends ProjectableSQLQuery<T,Q>
AbstractSQLQuery is the base type for SQL query implementations- Author:
- tiwe
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SQLListenersprotected static final Stringprotected booleanFields inherited from class com.querydsl.sql.ProjectableSQLQuery
configuration, firstUnionSubQuery, union, unionAllFields inherited from class com.querydsl.core.support.QueryBase
MDC_PARAMETERS, MDC_QUERY, queryMixin -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSQLQuery(@Nullable Connection conn, Configuration configuration) AbstractSQLQuery(@Nullable Connection conn, Configuration configuration, QueryMetadata metadata) AbstractSQLQuery(Supplier<Connection> connProvider, Configuration configuration) AbstractSQLQuery(Supplier<Connection> connProvider, Configuration configuration, QueryMetadata metadata) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(SQLListener listener) Add a listenerCreate an alias for the expressionCreate an alias for the expressionclone()abstract Qclone(Connection connection) protected voidprotected SQLSerializerprotected voidendContext(SQLListenerContext context) Called to end a SQL listener contextfetch()longforShare()FOR SHARE causes the rows retrieved by the SELECT statement to be locked as though for update.forShare(boolean fallbackToForUpdate) FOR SHARE causes the rows retrieved by the SELECT statement to be locked as though for update.If you use forUpdate() with a backend that uses page or row locks, rows examined by the query are write-locked until the end of the current transaction.protected ConfigurationGet the results as a JDBC ResultSetgetResults(Expression<?>... exprs) Deprecated.com.mysema.commons.lang.CloseableIterator<T>iterate()protected voidlogQuery(String queryString, Collection<Object> parameters) protected voidonException(SQLListenerContextImpl context, Exception e) Called to make the call back to listeners when an exception happensprotected voidsetParameters(PreparedStatement stmt, List<?> objects, List<Path<?>> constantPaths, Map<ParamExpression<?>, ?> params) voidsetStatementOptions(StatementOptions statementOptions) Set the options to be applied to the JDBC statements of this queryvoidsetUseLiterals(boolean useLiterals) Set whether literals are used in SQL strings instead of parameter bindings (default: false)protected SQLListenerContextImplstartContext(Connection connection, QueryMetadata metadata) Called to create and start a new SQL Listener contextMethods inherited from class com.querydsl.sql.ProjectableSQLQuery
accept, addFlag, addFlag, addFlag, addFlag, addJoinFlag, addJoinFlag, fetchOne, from, from, from, fullJoin, fullJoin, fullJoin, fullJoin, fullJoin, getSQL, getSQL, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, join, join, join, join, join, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, on, on, rightJoin, rightJoin, rightJoin, rightJoin, rightJoin, serialize, toString, union, union, union, unionAll, unionAll, unionAll, with, with, with, withRecursive, withRecursive, withRecursiveMethods inherited from class com.querydsl.core.support.FetchableSubQueryBase
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.Fetchable
fetchFirst, streamMethods inherited from interface com.querydsl.core.FetchableQuery
select, select, transformMethods inherited from interface com.querydsl.core.FilteredClause
where
-
Field Details
-
PARENT_CONTEXT
-
listeners
-
useLiterals
protected boolean useLiterals
-
-
Constructor Details
-
AbstractSQLQuery
-
AbstractSQLQuery
public AbstractSQLQuery(@Nullable @Nullable Connection conn, Configuration configuration, QueryMetadata metadata) -
AbstractSQLQuery
-
AbstractSQLQuery
public AbstractSQLQuery(Supplier<Connection> connProvider, Configuration configuration, QueryMetadata metadata)
-
-
Method Details
-
as
Create an alias for the expression- Parameters:
alias- alias- Returns:
- this as alias
-
as
Create an alias for the expression- Parameters:
alias- alias- Returns:
- this as alias
-
addListener
Add a listener- Parameters:
listener- listener to add
-
fetchCount
public long fetchCount()- Specified by:
fetchCountin interfaceFetchable<T>- Overrides:
fetchCountin classProjectableSQLQuery<T,Q extends AbstractSQLQuery<T, Q>>
-
forUpdate
If you use forUpdate() with a backend that uses page or row locks, rows examined by the query are write-locked until the end of the current transaction. Not supported for SQLite and CUBRID- Returns:
- the current object
-
createSerializer
- Specified by:
createSerializerin classProjectableSQLQuery<T,Q extends AbstractSQLQuery<T, Q>>
-
startContext
Called to create and start a new SQL Listener context- Parameters:
connection- the database connectionmetadata- the meta data for that context- Returns:
- the newly started context
-
onException
Called to make the call back to listeners when an exception happens- Parameters:
context- the current context in playe- the exception
-
endContext
Called to end a SQL listener context- Parameters:
context- the listener context to end
-
getResults
Deprecated.Use @{code select(..)} to define the projection andgetResults()to obtain the result setGet the results as a JDBC ResultSet- Parameters:
exprs- the expression arguments to retrieve- Returns:
- results as ResultSet
-
getResults
Get the results as a JDBC ResultSet- Returns:
- results as ResultSet
-
getConfiguration
-
iterate
-
fetch
- Specified by:
fetchin interfaceFetchable<T>- Overrides:
fetchin classFetchableQueryBase<T,Q extends AbstractSQLQuery<T, Q>>
-
fetchResults
-
setParameters
protected void setParameters(PreparedStatement stmt, List<?> objects, List<Path<?>> constantPaths, Map<ParamExpression<?>, ?> params) -
logQuery
-
setUseLiterals
public void setUseLiterals(boolean useLiterals) Set whether literals are used in SQL strings instead of parameter bindings (default: false)Warning: When literals are used, prepared statement won't have any parameter bindings and also batch statements will only be simulated, but not executed as actual batch statements.
- Parameters:
useLiterals- true for literals and false for bindings
-
clone
- Overrides:
clonein classProjectableSQLQuery<T,Q extends AbstractSQLQuery<T, Q>>
-
clone
- Specified by:
clonein classProjectableSQLQuery<T,Q extends AbstractSQLQuery<T, Q>>
-
clone
-
setStatementOptions
Set the options to be applied to the JDBC statements of this query- Parameters:
statementOptions- options to be applied to statements
-
getResults()to obtain the result set