public class SQLMergeClause extends AbstractSQLClause<SQLMergeClause> implements StoreClause<SQLMergeClause>
SQLMergeClause defines an MERGE INTO clause| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<SQLMergeBatch> |
batches |
protected java.util.List<Path<?>> |
columns |
protected java.util.List<java.lang.Object> |
constants |
protected RelationalPath<?> |
entity |
protected java.util.List<Path<?>> |
keys |
protected static java.util.logging.Logger |
logger |
protected QueryMetadata |
metadata |
protected java.lang.String |
queryString |
protected @Nullable SubQueryExpression<?> |
subQuery |
protected java.util.List<Expression<?>> |
values |
configuration, context, listeners, useLiterals| Constructor and Description |
|---|
SQLMergeClause(java.sql.Connection connection,
Configuration configuration,
RelationalPath<?> entity) |
SQLMergeClause(java.sql.Connection connection,
SQLTemplates templates,
RelationalPath<?> entity) |
SQLMergeClause(java.util.function.Supplier<java.sql.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,
java.lang.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 java.sql.PreparedStatement |
createStatement(boolean withKeys) |
protected java.util.Collection<java.sql.PreparedStatement> |
createStatements(boolean withKeys) |
long |
execute() |
protected long |
executeCompositeMerge() |
protected long |
executeNativeMerge() |
<T> T |
executeWithKey(java.lang.Class<T> type)
Execute the clause and return the generated key cast to the given type.
|
protected <T> T |
executeWithKey(java.lang.Class<T> type,
@Nullable Path<T> path) |
<T> T |
executeWithKey(Path<T> path)
Execute the clause and return the generated key with the type of the given path.
|
java.sql.ResultSet |
executeWithKeys()
Execute the clause and return the generated keys as a ResultSet
|
<T> java.util.List<T> |
executeWithKeys(java.lang.Class<T> type) |
protected <T> java.util.List<T> |
executeWithKeys(java.lang.Class<T> type,
@Nullable Path<T> path) |
<T> java.util.List<T> |
executeWithKeys(Path<T> path)
Execute the clause and return the generated key with the type of the given path.
|
int |
getBatchCount() |
protected java.util.List<? extends Path<?>> |
getKeys() |
java.util.List<SQLBindings> |
getSQL()
Get the SQL string and bindings
|
protected boolean |
hasRow() |
boolean |
isEmpty() |
SQLMergeClause |
keys(Path<?>... paths)
Set the keys to be used in the MERGE clause
|
protected void |
populate(StoreClause<?> clause) |
protected java.sql.PreparedStatement |
prepareStatementAndSetParameters(SQLSerializer serializer,
boolean withKeys) |
SQLMergeClause |
select(SubQueryExpression<?> subQuery) |
<T> SQLMergeClause |
set(Path<T> path,
Expression<? extends T> expression) |
<T> SQLMergeClause |
set(Path<T> path,
T value) |
<T> SQLMergeClause |
setNull(Path<T> path) |
java.lang.String |
toString() |
SQLMergeClause |
values(java.lang.Object... v) |
addListener, close, close, close, connection, createBindings, createSerializer, endContext, executeBatch, logQuery, onException, reset, setParameters, setUseLiterals, startContextprotected static final java.util.logging.Logger logger
protected final java.util.List<Path<?>> columns
protected final RelationalPath<?> entity
protected final QueryMetadata metadata
protected final java.util.List<Path<?>> keys
@Nullable protected @Nullable SubQueryExpression<?> subQuery
protected final java.util.List<SQLMergeBatch> batches
protected final java.util.List<Expression<?>> values
protected transient java.lang.String queryString
protected transient java.util.List<java.lang.Object> constants
public SQLMergeClause(java.sql.Connection connection,
SQLTemplates templates,
RelationalPath<?> entity)
public SQLMergeClause(java.sql.Connection connection,
Configuration configuration,
RelationalPath<?> entity)
public SQLMergeClause(java.util.function.Supplier<java.sql.Connection> connection,
Configuration configuration,
RelationalPath<?> entity)
public SQLMergeClause addFlag(QueryFlag.Position position, java.lang.String flag)
position - positionflag - query flagpublic SQLMergeClause addFlag(QueryFlag.Position position, Expression<?> flag)
position - positionflag - query flagprotected java.util.List<? extends Path<?>> getKeys()
public SQLMergeClause addBatch()
public void clear()
AbstractSQLClauseclear 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(java.lang.Class<T> type)
T - type - type of keyprotected <T> T executeWithKey(java.lang.Class<T> type,
@Nullable
@Nullable Path<T> path)
public <T> java.util.List<T> executeWithKeys(Path<T> path)
T - path - path for keypublic <T> java.util.List<T> executeWithKeys(java.lang.Class<T> type)
protected <T> java.util.List<T> executeWithKeys(java.lang.Class<T> type,
@Nullable
@Nullable Path<T> path)
public java.sql.ResultSet executeWithKeys()
public long execute()
execute in interface DMLClause<SQLMergeClause>public java.util.List<SQLBindings> getSQL()
AbstractSQLClausegetSQL 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 java.sql.PreparedStatement createStatement(boolean withKeys)
throws java.sql.SQLException
java.sql.SQLExceptionprotected java.util.Collection<java.sql.PreparedStatement> createStatements(boolean withKeys)
throws java.sql.SQLException
java.sql.SQLExceptionprotected java.sql.PreparedStatement prepareStatementAndSetParameters(SQLSerializer serializer, boolean withKeys) throws java.sql.SQLException
java.sql.SQLExceptionprotected long executeNativeMerge()
public SQLMergeClause keys(Path<?>... paths)
paths - keyspublic SQLMergeClause select(SubQueryExpression<?> subQuery)
public <T> SQLMergeClause set(Path<T> path, @Nullable T value)
set in interface StoreClause<SQLMergeClause>public <T> SQLMergeClause set(Path<T> path, Expression<? extends T> expression)
set in interface StoreClause<SQLMergeClause>public <T> SQLMergeClause setNull(Path<T> path)
setNull in interface StoreClause<SQLMergeClause>public java.lang.String toString()
toString in class java.lang.Objectpublic SQLMergeClause values(java.lang.Object... v)
public boolean isEmpty()
isEmpty in interface StoreClause<SQLMergeClause>public int getBatchCount()
getBatchCount in class AbstractSQLClause<SQLMergeClause>Copyright © 2007–2021 Querydsl. All rights reserved.