public class SQLInsertClause extends AbstractSQLClause<SQLInsertClause> implements InsertClause<SQLInsertClause>
configuration, context, listeners, useLiterals
Constructor and Description |
---|
SQLInsertClause(Connection connection,
Configuration configuration,
RelationalPath<?> entity) |
SQLInsertClause(Connection connection,
Configuration configuration,
RelationalPath<?> entity,
SQLQuery<?> subQuery) |
SQLInsertClause(Connection connection,
SQLTemplates templates,
RelationalPath<?> entity) |
SQLInsertClause(Connection connection,
SQLTemplates templates,
RelationalPath<?> entity,
SQLQuery<?> subQuery) |
SQLInsertClause(javax.inject.Provider<Connection> connection,
Configuration configuration,
RelationalPath<?> entity) |
SQLInsertClause(javax.inject.Provider<Connection> connection,
Configuration configuration,
RelationalPath<?> entity,
SQLQuery<?> subQuery) |
Modifier and Type | Method and Description |
---|---|
SQLInsertClause |
addBatch()
Add the current state of bindings as a batch item
|
SQLInsertClause |
addFlag(QueryFlag.Position position,
Expression<?> flag)
Add the given Expression at the given position as a query flag
|
SQLInsertClause |
addFlag(QueryFlag.Position position,
String flag)
Add the given String literal at the given position as a query flag
|
void |
clear()
Clear the internal state of the clause
|
SQLInsertClause |
columns(Path<?>... columns)
Define the columns to be populated
|
long |
execute()
Execute the clause and return the amount of affected rows
|
<T> T |
executeWithKey(Class<T> type)
Execute the clause and return the generated key cast to the given type.
|
<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) |
<T> List<T> |
executeWithKeys(Path<T> path)
Execute the clause and return the generated key with the type of the
given path.
|
int |
getBatchCount() |
List<SQLBindings> |
getSQL()
Get the SQL string and bindings
|
boolean |
isEmpty()
Returns true, if no bindings have been set, otherwise false.
|
SQLInsertClause |
populate(Object bean)
Populate the INSERT clause with the properties of the given bean.
|
<T> SQLInsertClause |
populate(T obj,
Mapper<T> mapper)
Populate the INSERT clause with the properties of the given bean using
the given Mapper.
|
SQLInsertClause |
select(SubQueryExpression<?> sq)
Define the populate via subquery
|
<T> SQLInsertClause |
set(Path<T> path,
Expression<? extends T> expression)
Add an expression binding
|
<T> SQLInsertClause |
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> SQLInsertClause |
setNull(Path<T> path)
Bind the given path to null
|
String |
toString() |
SQLInsertClause |
values(Object... v)
Define the value bindings
|
addListener, cleanupMDC, close, close, close, connection, createBindings, createSerializer, endContext, executeBatch, logQuery, onException, reset, setParameters, setUseLiterals, startContext
public SQLInsertClause(Connection connection, SQLTemplates templates, RelationalPath<?> entity)
public SQLInsertClause(Connection connection, SQLTemplates templates, RelationalPath<?> entity, SQLQuery<?> subQuery)
public SQLInsertClause(Connection connection, Configuration configuration, RelationalPath<?> entity, SQLQuery<?> subQuery)
public SQLInsertClause(Connection connection, Configuration configuration, RelationalPath<?> entity)
public SQLInsertClause(javax.inject.Provider<Connection> connection, Configuration configuration, RelationalPath<?> entity, SQLQuery<?> subQuery)
public SQLInsertClause(javax.inject.Provider<Connection> connection, Configuration configuration, RelationalPath<?> entity)
public SQLInsertClause addFlag(QueryFlag.Position position, String flag)
position
- positionflag
- query flagpublic SQLInsertClause addFlag(QueryFlag.Position position, Expression<?> flag)
position
- positionflag
- query flagpublic SQLInsertClause addBatch()
public void setBatchToBulk(boolean b)
public void clear()
AbstractSQLClause
clear
in class AbstractSQLClause<SQLInsertClause>
public SQLInsertClause columns(Path<?>... columns)
InsertClause
columns
in interface InsertClause<SQLInsertClause>
columns
- columns to be populated@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<SQLInsertClause>
public List<SQLBindings> getSQL()
AbstractSQLClause
getSQL
in class AbstractSQLClause<SQLInsertClause>
public SQLInsertClause select(SubQueryExpression<?> sq)
InsertClause
select
in interface InsertClause<SQLInsertClause>
sq
- sub query to be used for populationpublic <T> SQLInsertClause set(Path<T> path, T value)
StoreClause
set
in interface StoreClause<SQLInsertClause>
path
- path to be updatedvalue
- value to setpublic <T> SQLInsertClause set(Path<T> path, Expression<? extends T> expression)
StoreClause
set
in interface StoreClause<SQLInsertClause>
path
- path to be updatedexpression
- bindingpublic <T> SQLInsertClause setNull(Path<T> path)
StoreClause
setNull
in interface StoreClause<SQLInsertClause>
path
- path to be updatedpublic SQLInsertClause values(Object... v)
InsertClause
values
in interface InsertClause<SQLInsertClause>
v
- values to be insertedpublic SQLInsertClause populate(Object bean)
bean
- bean to use for populationpublic <T> SQLInsertClause populate(T obj, Mapper<T> mapper)
obj
- object to use for populationmapper
- mapper to usepublic boolean isEmpty()
StoreClause
isEmpty
in interface StoreClause<SQLInsertClause>
public int getBatchCount()
getBatchCount
in class AbstractSQLClause<SQLInsertClause>
Copyright © 2007–2016 Querydsl. All rights reserved.