|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sormula.operation.SqlOperation<R> org.sormula.operation.ModifyOperation<R> org.sormula.operation.InsertOperation<R>
R
- class type which contains members for columns of a row in a tablepublic class InsertOperation<R>
SQL insert operation for row of type R.
Constructor Summary | |
---|---|
InsertOperation(Table<R> table)
Constructs for standard sql insert statement as: INSERT INTO table (c1, c2, c3, ...) VALUES (?, ?, ?, ...) |
Method Summary | |
---|---|
protected void |
initBaseSql()
Sets base sql with SqlOperation.setBaseSql(String) . |
int |
insert(java.lang.Object... parameters)
Inserts rows based upon parameters. |
int |
insert(R row)
Inserts a row. |
int |
insertAll(java.util.Collection<R> rows)
Inserts all rows in collection. |
protected void |
postExecute(R row)
Updates identity column with generated key if SqlOperation.isAutoGeneratedKeys() is true. |
protected java.util.List<CascadeOperation<R,?>> |
prepareCascades(java.lang.reflect.Field field)
Creates and prepares cascade operations based upon cascade annotations for a field. |
protected void |
processIdentityColumn(R row)
Reads the generated key using Statement.getGeneratedKeys() . |
Methods inherited from class org.sormula.operation.ModifyOperation |
---|
close, execute, getRowsAffected, isBatch, modify, modify, modifyAll, postExecuteCascade, preExecute, preExecuteCascade, setBatch, setParameters, setRow, setRows, setRows, setRows, setRowsAffected |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InsertOperation(Table<R> table) throws OperationException
table
- insert into this table
OperationException
- if errorMethod Detail |
---|
public int insert(R row) throws OperationException
ModifyOperation.modify(Object)
.
row
- row to use for parameters
ModifyOperation.getRowsAffected()
OperationException
- if errorpublic int insertAll(java.util.Collection<R> rows) throws OperationException
ModifyOperation.modifyAll(Collection)
.
rows
- collection of rows to use as parameters
ModifyOperation.getRowsAffected()
OperationException
- if errorpublic int insert(java.lang.Object... parameters) throws OperationException
ModifyOperation.modify(Object...)
.
parameters
- operation parameters as objects (see ModifyOperation.setParameters(Object...)
)
OperationException
- if errorprotected void initBaseSql()
SqlOperation.setBaseSql(String)
.
protected java.util.List<CascadeOperation<R,?>> prepareCascades(java.lang.reflect.Field field) throws OperationException
prepareCascades
in class SqlOperation<R>
field
- annotation is for this field of row class R
OperationException
- if errorprotected void postExecute(R row) throws OperationException
SqlOperation.isAutoGeneratedKeys()
is true.
postExecute
in class ModifyOperation<R>
row
- row for JDBC execute
OperationException
- if errorprotected void processIdentityColumn(R row) throws OperationException
Statement.getGeneratedKeys()
. The
generated key is set in row using the ColumnTranslator
from the table for
this operation as RowTranslator.getIdentityColumnTranslator()
.
row
- row to affect
OperationException
- if error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |