Package com.querydsl.sql.dml
Class AbstractSQLClause<C extends AbstractSQLClause<C>>
java.lang.Object
com.querydsl.sql.dml.AbstractSQLClause<C>
- Type Parameters:
C- concrete subtype
- All Implemented Interfaces:
DMLClause<C>
- Direct Known Subclasses:
AbstractSQLDeleteClause,AbstractSQLInsertClause,AbstractSQLUpdateClause,SetQueryBandClause,SQLMergeClause
public abstract class AbstractSQLClause<C extends AbstractSQLClause<C>>
extends Object
implements DMLClause<C>
AbstractSQLClause is a superclass for SQL based DMLClause implementations- Author:
- tiwe
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Configurationprotected SQLListenerContextImplprotected final SQLListenersprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSQLClause(Configuration configuration) AbstractSQLClause(Configuration configuration, Connection conn) AbstractSQLClause(Configuration configuration, Supplier<Connection> connProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(SQLListener listener) Add a listenerabstract voidclear()Clear the internal state of the clauseprotected voidprotected voidprotected voidclose(Collection<? extends Statement> stmts) protected Connectionprotected SQLBindingscreateBindings(QueryMetadata metadata, SQLSerializer serializer) protected SQLSerializerprotected voidendContext(SQLListenerContextImpl context) Called to end a SQL listener contextprotected longexecuteBatch(Collection<PreparedStatement> stmts) abstract intabstract List<SQLBindings>getSQL()Get the SQL string and bindingsprotected voidlogQuery(Logger logger, String queryString, Collection<Object> parameters) protected voidonException(SQLListenerContextImpl context, Exception e) Called to make the call back to listeners when an exception happensprotected voidreset()protected voidsetParameters(PreparedStatement stmt, List<?> objects, List<Path<?>> constantPaths, Map<ParamExpression<?>, ?> params) Set the parameters to the given PreparedStatementvoidsetUseLiterals(boolean useLiterals) protected SQLListenerContextImplstartContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) Called to create and start a new SQL Listener context
-
Field Details
-
configuration
-
listeners
-
useLiterals
protected boolean useLiterals -
context
-
-
Constructor Details
-
AbstractSQLClause
-
AbstractSQLClause
-
AbstractSQLClause
-
-
Method Details
-
addListener
Add a listener- Parameters:
listener- listener to add
-
clear
public abstract void clear()Clear the internal state of the clause -
startContext
protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) Called to create and start a new SQL Listener context- Parameters:
connection- the database connectionmetadata- the meta data for that contextentity- the entity 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
-
createBindings
-
createSerializer
-
getSQL
Get the SQL string and bindings- Returns:
- SQL and bindings
-
setParameters
protected void setParameters(PreparedStatement stmt, List<?> objects, List<Path<?>> constantPaths, Map<ParamExpression<?>, ?> params) Set the parameters to the given PreparedStatement- Parameters:
stmt- preparedStatement to be populatedobjects- list of constantsconstantPaths- list of paths related to the constantsparams- map of param to value for param resolving
-
executeBatch
- Throws:
SQLException
-
close
-
close
-
close
-
logQuery
-
reset
protected void reset() -
connection
-
setUseLiterals
public void setUseLiterals(boolean useLiterals) -
getBatchCount
public abstract int getBatchCount()
-