T - result typeQ - concrete subtypepublic abstract class AbstractSQLQuery<T,Q extends AbstractSQLQuery<T,Q>> extends ProjectableSQLQuery<T,Q>
AbstractSQLQuery is the base type for SQL query implementations| Modifier and Type | Field and Description |
|---|---|
protected SQLListeners |
listeners |
protected static String |
PARENT_CONTEXT |
protected boolean |
useLiterals |
configuration, firstUnionSubQuery, union, unionAllMDC_PARAMETERS, MDC_QUERY, queryMixin| Constructor and Description |
|---|
AbstractSQLQuery(Connection conn,
Configuration configuration) |
AbstractSQLQuery(Connection conn,
Configuration configuration,
QueryMetadata metadata) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(SQLListener listener)
Add a listener
|
SimpleExpression<T> |
as(Path<?> alias)
Create an alias for the expression
|
SimpleExpression<T> |
as(String alias)
Create an alias for the expression
|
protected void |
cleanupMDC() |
Q |
clone() |
abstract Q |
clone(Connection connection) |
protected void |
clone(Q query) |
protected SQLSerializer |
createSerializer() |
protected void |
endContext(SQLListenerContext context)
Called to end a SQL listener context
|
List<T> |
fetch()
Get the projection as a typed List
|
long |
fetchCount()
Get the count of matched elements
|
QueryResults<T> |
fetchResults()
Get the projection in
QueryResults form |
Q |
forShare()
FOR SHARE causes the rows retrieved by the SELECT statement to be locked as though for update.
|
Q |
forShare(boolean fallbackToForUpdate)
FOR SHARE causes the rows retrieved by the SELECT statement to be locked as though for update.
|
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.
|
protected Configuration |
getConfiguration() |
ResultSet |
getResults(Expression<?>... exprs)
Get the results as an JDBC result set
|
com.mysema.commons.lang.CloseableIterator<T> |
iterate()
Get the projection as a typed closeable Iterator
|
protected void |
logQuery(String queryString,
Collection<Object> parameters) |
protected void |
onException(SQLListenerContextImpl context,
Exception e)
Called to make the call back to listeners when an exception happens
|
protected void |
setParameters(PreparedStatement stmt,
List<?> objects,
List<Path<?>> constantPaths,
Map<ParamExpression<?>,?> params) |
void |
setStatementOptions(StatementOptions statementOptions) |
void |
setUseLiterals(boolean useLiterals) |
protected SQLListenerContextImpl |
startContext(Connection connection,
QueryMetadata metadata)
Called to create and start a new SQL Listener context
|
accept, addFlag, addFlag, addFlag, addFlag, addJoinFlag, addJoinFlag, fetchOne, from, from, from, fullJoin, fullJoin, fullJoin, fullJoin, getSQL, innerJoin, innerJoin, innerJoin, innerJoin, join, join, join, join, leftJoin, leftJoin, leftJoin, leftJoin, on, on, rightJoin, rightJoin, rightJoin, rightJoin, serialize, toString, union, union, union, unionAll, unionAll, unionAll, with, with, with, withRecursive, withRecursive, withRecursivecontains, contains, eq, eq, exists, getMetadata, getType, goe, goe, gt, gt, hashCode, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExistsequals, fetchFirst, transform, uniqueResultdistinct, groupBy, groupBy, having, having, limit, offset, orderBy, orderBy, restrict, set, where, wherefinalize, getClass, notify, notifyAll, wait, wait, waitdistinct, limit, offset, orderBy, restrict, setwhereselect, select, transformfetchFirstprotected static final String PARENT_CONTEXT
protected SQLListeners listeners
protected boolean useLiterals
public AbstractSQLQuery(@Nullable Connection conn, Configuration configuration)
public AbstractSQLQuery(@Nullable Connection conn, Configuration configuration, QueryMetadata metadata)
public SimpleExpression<T> as(String alias)
alias - aliaspublic SimpleExpression<T> as(Path<?> alias)
alias - aliaspublic void addListener(SQLListener listener)
listener - listener to addpublic long fetchCount()
FetchablefetchCount in interface Fetchable<T>fetchCount in class ProjectableSQLQuery<T,Q extends AbstractSQLQuery<T,Q>>public Q forUpdate()
public Q forShare()
QueryException - if the FOR SHARE is not supported.public Q forShare(boolean fallbackToForUpdate)
fallbackToForUpdate - if the FOR SHARE is not supported and this parameter is true, the
forUpdate() functionality will be used.QueryException - if the FOR SHARE is not supported and fallbackToForUpdate is set to
false.protected SQLSerializer createSerializer()
createSerializer in class ProjectableSQLQuery<T,Q extends AbstractSQLQuery<T,Q>>protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata)
connection - the database connectionmetadata - the meta data for that contextprotected void onException(SQLListenerContextImpl context, Exception e)
context - the current context in playe - the exceptionprotected void endContext(SQLListenerContext context)
context - the listener context to endpublic ResultSet getResults(Expression<?>... exprs)
exprs - the expression arguments to retrieveprotected Configuration getConfiguration()
public com.mysema.commons.lang.CloseableIterator<T> iterate()
Fetchablepublic List<T> fetch()
Fetchablefetch in interface Fetchable<T>fetch in class FetchableQueryBase<T,Q extends AbstractSQLQuery<T,Q>>public QueryResults<T> fetchResults()
FetchableQueryResults formprotected void setParameters(PreparedStatement stmt, List<?> objects, List<Path<?>> constantPaths, Map<ParamExpression<?>,?> params)
protected void logQuery(String queryString, Collection<Object> parameters)
protected void cleanupMDC()
public void setUseLiterals(boolean useLiterals)
protected void clone(Q query)
clone in class ProjectableSQLQuery<T,Q extends AbstractSQLQuery<T,Q>>public Q clone()
clone in class ProjectableSQLQuery<T,Q extends AbstractSQLQuery<T,Q>>public abstract Q clone(Connection connection)
public void setStatementOptions(StatementOptions statementOptions)
Copyright © 2007–2015 Querydsl. All rights reserved.