public class SQLMergeClause extends AbstractSQLClause<SQLMergeClause> implements StoreClause<SQLMergeClause>
SQLMergeClause
defines an MERGE INTO clauseModifier and Type | Field and Description |
---|---|
protected List<SQLMergeBatch> |
batches |
protected List<Path<?>> |
columns |
protected List<Object> |
constants |
protected RelationalPath<?> |
entity |
protected List<Path<?>> |
keys |
protected static org.slf4j.Logger |
logger |
protected QueryMetadata |
metadata |
protected String |
queryString |
protected SubQueryExpression<?> |
subQuery |
protected List<Expression<?>> |
values |
configuration, context, listeners, useLiterals
Constructor and Description |
---|
SQLMergeClause(Connection connection,
Configuration configuration,
RelationalPath<?> entity) |
SQLMergeClause(Connection connection,
SQLTemplates templates,
RelationalPath<?> entity) |
SQLMergeClause(javax.inject.Provider<Connection> connection,
Configuration configuration,
RelationalPath<?> entity) |
Modifier and Type | Method and Description |
---|---|
SQLMergeClause |
addBatch()
Add the current state of bindings as a batch item
|
SQLMergeClause |
addFlag(QueryFlag.Position position,
Expression<?> flag)
Add the given Expression at the given position as a query flag
|
SQLMergeClause |
addFlag(QueryFlag.Position position,
String flag)
Add the given String literal at the given position as a query flag
|
protected void |
addKeyConditions(FilteredClause<?> query) |
protected void |
addListeners(AbstractSQLClause<?> clause) |
void |
clear()
Clear the internal state of the clause
|
SQLMergeClause |
columns(Path<?>... columns) |
protected PreparedStatement |
createStatement(boolean withKeys) |
protected Collection<PreparedStatement> |
createStatements(boolean withKeys) |
long |
execute()
Execute the clause and return the amount of affected rows
|
protected long |
executeCompositeMerge() |
protected long |
executeNativeMerge() |
<T> T |
executeWithKey(Class<T> type)
Execute the clause and return the generated key cast to the given type.
|
protected <T> T |
executeWithKey(Class<T> type,
Path<T> path) |
<T> T |
executeWithKey(Path<T> path)
Execute the clause and return the generated key with the type of the given path.
|
ResultSet |
executeWithKeys()
Execute the clause and return the generated keys as a ResultSet
|
<T> List<T> |
executeWithKeys(Class<T> type) |
protected <T> List<T> |
executeWithKeys(Class<T> type,
Path<T> path) |
<T> List<T> |
executeWithKeys(Path<T> path)
Execute the clause and return the generated key with the type of the given path.
|
int |
getBatchCount() |
protected List<? extends Path<?>> |
getKeys() |
List<SQLBindings> |
getSQL()
Get the SQL string and bindings
|
protected boolean |
hasRow() |
boolean |
isEmpty()
Returns true, if no bindings have been set, otherwise false.
|
SQLMergeClause |
keys(Path<?>... paths)
Set the keys to be used in the MERGE clause
|
protected void |
populate(StoreClause<?> clause) |
protected PreparedStatement |
prepareStatementAndSetParameters(SQLSerializer serializer,
boolean withKeys) |
SQLMergeClause |
select(SubQueryExpression<?> subQuery) |
<T> SQLMergeClause |
set(Path<T> path,
Expression<? extends T> expression)
Add an expression binding
|
<T> SQLMergeClause |
set(Path<T> path,
T value)
Add a value binding
|
<T> SQLMergeClause |
setNull(Path<T> path)
Bind the given path to null
|
String |
toString() |
SQLMergeClause |
values(Object... v) |
addListener, cleanupMDC, close, close, close, connection, createBindings, createSerializer, endContext, executeBatch, logQuery, onException, reset, setParameters, setUseLiterals, startContext
protected static final org.slf4j.Logger logger
protected final RelationalPath<?> entity
protected final QueryMetadata metadata
@Nullable protected SubQueryExpression<?> subQuery
protected final List<SQLMergeBatch> batches
protected final List<Expression<?>> values
protected transient String queryString
public SQLMergeClause(Connection connection, SQLTemplates templates, RelationalPath<?> entity)
public SQLMergeClause(Connection connection, Configuration configuration, RelationalPath<?> entity)
public SQLMergeClause(javax.inject.Provider<Connection> connection, Configuration configuration, RelationalPath<?> entity)
public SQLMergeClause addFlag(QueryFlag.Position position, String flag)
position
- positionflag
- query flagpublic SQLMergeClause addFlag(QueryFlag.Position position, Expression<?> flag)
position
- positionflag
- query flagpublic SQLMergeClause addBatch()
public void clear()
AbstractSQLClause
clear
in class AbstractSQLClause<SQLMergeClause>
public SQLMergeClause columns(Path<?>... columns)
@Nullable public <T> T executeWithKey(Path<T> path)
T
- path
- path for keypublic <T> T executeWithKey(Class<T> type)
T
- type
- type of keypublic <T> List<T> executeWithKeys(Path<T> path)
T
- path
- path for keypublic ResultSet executeWithKeys()
public long execute()
DMLClause
execute
in interface DMLClause<SQLMergeClause>
public List<SQLBindings> getSQL()
AbstractSQLClause
getSQL
in class AbstractSQLClause<SQLMergeClause>
protected boolean hasRow()
protected void addKeyConditions(FilteredClause<?> query)
protected long executeCompositeMerge()
protected void addListeners(AbstractSQLClause<?> clause)
protected void populate(StoreClause<?> clause)
protected PreparedStatement createStatement(boolean withKeys) throws SQLException
SQLException
protected Collection<PreparedStatement> createStatements(boolean withKeys) throws SQLException
SQLException
protected PreparedStatement prepareStatementAndSetParameters(SQLSerializer serializer, boolean withKeys) throws SQLException
SQLException
protected long executeNativeMerge()
public SQLMergeClause keys(Path<?>... paths)
paths
- keyspublic SQLMergeClause select(SubQueryExpression<?> subQuery)
public <T> SQLMergeClause set(Path<T> path, @Nullable T value)
StoreClause
set
in interface StoreClause<SQLMergeClause>
path
- path to be updatedvalue
- value to setpublic <T> SQLMergeClause set(Path<T> path, Expression<? extends T> expression)
StoreClause
set
in interface StoreClause<SQLMergeClause>
path
- path to be updatedexpression
- bindingpublic <T> SQLMergeClause setNull(Path<T> path)
StoreClause
setNull
in interface StoreClause<SQLMergeClause>
path
- path to be updatedpublic SQLMergeClause values(Object... v)
public boolean isEmpty()
StoreClause
isEmpty
in interface StoreClause<SQLMergeClause>
public int getBatchCount()
getBatchCount
in class AbstractSQLClause<SQLMergeClause>
Copyright © 2007–2020 Querydsl. All rights reserved.