C
- The type extending this class.public abstract class AbstractSQLInsertClause<C extends AbstractSQLInsertClause<C>> extends AbstractSQLClause<C> implements InsertClause<C>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<SQLInsertBatch> |
batches |
protected boolean |
batchToBulk |
protected java.util.List<Path<?>> |
columns |
protected java.util.List<java.lang.Object> |
constants |
protected RelationalPath<?> |
entity |
protected static java.util.logging.Logger |
logger |
protected QueryMetadata |
metadata |
protected java.lang.String |
queryString |
protected @Nullable SubQueryExpression<?> |
subQuery |
protected @Nullable SQLQuery<?> |
subQueryBuilder |
protected java.util.List<Expression<?>> |
values |
configuration, context, listeners, useLiterals
Constructor and Description |
---|
AbstractSQLInsertClause(java.sql.Connection connection,
Configuration configuration,
RelationalPath<?> entity) |
AbstractSQLInsertClause(java.sql.Connection connection,
Configuration configuration,
RelationalPath<?> entity,
SQLQuery<?> subQuery) |
AbstractSQLInsertClause(java.util.function.Supplier<java.sql.Connection> connection,
Configuration configuration,
RelationalPath<?> entity) |
AbstractSQLInsertClause(java.util.function.Supplier<java.sql.Connection> connection,
Configuration configuration,
RelationalPath<?> entity,
SQLQuery<?> subQuery) |
Modifier and Type | Method and Description |
---|---|
C |
addBatch()
Add the current state of bindings as a batch item
|
C |
addFlag(QueryFlag.Position position,
Expression<?> flag)
Add the given Expression at the given position as a query flag
|
C |
addFlag(QueryFlag.Position position,
java.lang.String flag)
Add the given String literal at the given position as a query flag
|
void |
clear()
Clear the internal state of the clause
|
C |
columns(Path<?>... columns)
Define the columns to be populated
|
protected java.sql.PreparedStatement |
createStatement(boolean withKeys) |
protected java.util.Collection<java.sql.PreparedStatement> |
createStatements(boolean withKeys) |
long |
execute()
Execute the clause and return the amount of affected rows
|
<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() |
java.util.List<SQLBindings> |
getSQL()
Get the SQL string and bindings
|
boolean |
isEmpty()
Returns true, if no bindings have been set, otherwise false.
|
C |
populate(java.lang.Object bean)
Populate the INSERT clause with the properties of the given bean.
|
<T> C |
populate(T obj,
Mapper<T> mapper)
Populate the INSERT clause with the properties of the given bean using
the given Mapper.
|
protected java.sql.PreparedStatement |
prepareStatementAndSetParameters(SQLSerializer serializer,
boolean withKeys) |
C |
select(SubQueryExpression<?> sq)
Define the populate via subquery
|
<T> C |
set(Path<T> path,
Expression<? extends T> expression)
Add an expression binding
|
<T> C |
set(Path<T> path,
T value)
Add a value binding
|
void |
setBatchToBulk(boolean b)
Set whether batches should be optimized into a single bulk operation.
|
<T> C |
setNull(Path<T> path)
Bind the given path to null
|
java.lang.String |
toString() |
C |
values(java.lang.Object... v)
Define the value bindings
|
addListener, close, close, close, connection, createBindings, createSerializer, endContext, executeBatch, logQuery, onException, reset, setParameters, setUseLiterals, startContext
protected static final java.util.logging.Logger logger
protected final RelationalPath<?> entity
protected final QueryMetadata metadata
@Nullable protected @Nullable SubQueryExpression<?> subQuery
@Nullable protected @Nullable SQLQuery<?> subQueryBuilder
protected final java.util.List<SQLInsertBatch> batches
protected final java.util.List<Path<?>> columns
protected final java.util.List<Expression<?>> values
protected transient java.lang.String queryString
protected transient java.util.List<java.lang.Object> constants
protected transient boolean batchToBulk
public AbstractSQLInsertClause(java.sql.Connection connection, Configuration configuration, RelationalPath<?> entity, SQLQuery<?> subQuery)
public AbstractSQLInsertClause(java.sql.Connection connection, Configuration configuration, RelationalPath<?> entity)
public AbstractSQLInsertClause(java.util.function.Supplier<java.sql.Connection> connection, Configuration configuration, RelationalPath<?> entity, SQLQuery<?> subQuery)
public AbstractSQLInsertClause(java.util.function.Supplier<java.sql.Connection> connection, Configuration configuration, RelationalPath<?> entity)
public C addFlag(QueryFlag.Position position, java.lang.String flag)
position
- positionflag
- query flagpublic C addFlag(QueryFlag.Position position, Expression<?> flag)
position
- positionflag
- query flagpublic C addBatch()
public void setBatchToBulk(boolean b)
public void clear()
AbstractSQLClause
clear
in class AbstractSQLClause<C extends AbstractSQLInsertClause<C>>
public C columns(Path<?>... columns)
InsertClause
columns
in interface InsertClause<C extends AbstractSQLInsertClause<C>>
columns
- columns to be populated@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)
protected java.sql.PreparedStatement createStatement(boolean withKeys) throws java.sql.SQLException
java.sql.SQLException
protected java.util.Collection<java.sql.PreparedStatement> createStatements(boolean withKeys) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.PreparedStatement prepareStatementAndSetParameters(SQLSerializer serializer, boolean withKeys) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet executeWithKeys()
public long execute()
DMLClause
execute
in interface DMLClause<C extends AbstractSQLInsertClause<C>>
public java.util.List<SQLBindings> getSQL()
AbstractSQLClause
getSQL
in class AbstractSQLClause<C extends AbstractSQLInsertClause<C>>
public C select(SubQueryExpression<?> sq)
InsertClause
select
in interface InsertClause<C extends AbstractSQLInsertClause<C>>
sq
- sub query to be used for populationpublic <T> C set(Path<T> path, T value)
StoreClause
set
in interface StoreClause<C extends AbstractSQLInsertClause<C>>
path
- path to be updatedvalue
- value to setpublic <T> C set(Path<T> path, Expression<? extends T> expression)
StoreClause
set
in interface StoreClause<C extends AbstractSQLInsertClause<C>>
path
- path to be updatedexpression
- bindingpublic <T> C setNull(Path<T> path)
StoreClause
setNull
in interface StoreClause<C extends AbstractSQLInsertClause<C>>
path
- path to be updatedpublic C values(java.lang.Object... v)
InsertClause
values
in interface InsertClause<C extends AbstractSQLInsertClause<C>>
v
- values to be insertedpublic java.lang.String toString()
toString
in class java.lang.Object
public C populate(java.lang.Object bean)
bean
- bean to use for populationpublic <T> C populate(T obj, Mapper<T> mapper)
obj
- object to use for populationmapper
- mapper to usepublic boolean isEmpty()
StoreClause
isEmpty
in interface StoreClause<C extends AbstractSQLInsertClause<C>>
public int getBatchCount()
getBatchCount
in class AbstractSQLClause<C extends AbstractSQLInsertClause<C>>
Copyright © 2007–2021 Querydsl. All rights reserved.