R - class type which contains members for columns of a row in a tablepublic abstract class ModifyOperation<R> extends SqlOperation<R>
| Constructor and Description |
|---|
ModifyOperation(Table<R> table)
Constructs for a table.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cleans up after operation is no longer needed.
|
void |
execute()
Executes operation for all row parameters using current prepared statement.
|
int |
getRowsAffected()
Gets the number of rows affected from most recent invocation of
execute(). |
boolean |
isBatch()
Gets batch mode.
|
int |
modify(java.lang.Object... parameters)
Modifies row(s) with sql parametes as Objects
|
int |
modify(R row)
Modifies one row.
|
int |
modifyAll(java.util.Collection<R> rows)
Modifies a collection of rows.
|
protected void |
postExecute(R row)
Invoked after JDBC execute.
|
protected void |
postExecuteCascade(R row)
Invoked after JDBC execute.
|
protected void |
preExecute(R row)
Invoked prior to JDBC execute.
|
protected void |
preExecuteCascade(R row)
Invoked prior to JDBC execute.
|
void |
setBatch(boolean batch)
Sets batch mode.
|
void |
setParameters(java.lang.Object... parameters)
Allows modification of table data using objects instead from row objects.
|
void |
setRow(R row)
Sets parameters from a row object.
|
void |
setRows(java.util.Collection<R> rows)
Sets parameters from rows in a collection.
|
void |
setRows(java.util.Map<?,R> rows)
Sets parameters from rows in a map.
|
void |
setRows(R[] rows)
Sets parameters from rows in an array.
|
protected void |
setRowsAffected(int rowsAffected) |
cancel, cascade, closeCascades, closeStatement, createTargetField, getBaseSql, getConnection, getCustomSql, getNextParameter, getOperationTime, getParameters, getPreparedSql, getPreparedStatement, getQueryTimeout, getSql, getTable, getTargetTable, getTimingId, getWhereConditionName, getWhereTranslator, initOperationTime, isAutoGeneratedKeys, isIncludeIdentityColumns, isReadOnly, isTimings, logTimings, prepare, prepareCascades, prepareCascades, prepareCheck, setAutoGeneratedKeys, setBaseSql, setCustomSql, setIncludeIdentityColumns, setNextParameter, setQueryTimeout, setReadOnly, setTimingId, setTimings, setWhere, setWhereTranslator, writeColumns, writeParameter, writeParameters, writeWherepublic ModifyOperation(Table<R> table) throws OperationException
table - modify this tableOperationException - if errorpublic void setRow(R row)
setParameters(Object...).row - get parameter values from this row objectpublic void setRows(R[] rows)
rows - row objects to modifypublic void setRows(java.util.Collection<R> rows)
Collection of rows.rows - row objects to modifypublic void setRows(java.util.Map<?,R> rows)
Map of rows.rows - row objects to modifypublic void setParameters(java.lang.Object... parameters)
setRow(Object), setRows(Collection), or setRows(Map)
instead. preExecute(Object) and postExecute(Object) will not be invoked
if this method is used.setParameters in class SqlOperation<R>parameters - values to set in PreparedStatement for modify operationpublic boolean isBatch()
Statement.executeBatch()public void setBatch(boolean batch)
execute() to insert/update/delete rows using
JDBC batch mode. Batch mode does not support identity columns or cascades. Auto commit must
be off for batch mode. preExecute(Object) is invoked prior to batch add and
postExecute(Object) is invoked after batch execute.batch - true to use JDBC batching for execute()Statement.executeBatch()public void execute()
throws OperationException
getRowsAffected() will return the sum of all rows affected.execute in class SqlOperation<R>OperationException - if errorpublic void close()
throws OperationException
CascadeOperation objects. This method should
be invoked when operation is no longer needed for proper JDBC clean up.close in interface java.lang.AutoCloseableclose in class SqlOperation<R>OperationException - if errorpublic int getRowsAffected()
execute().execute()public int modify(R row) throws OperationException
row - row to use for parametersgetRowsAffected()OperationException - if errorpublic int modifyAll(java.util.Collection<R> rows) throws OperationException
rows - collection of rows to use as parametersgetRowsAffected()OperationException - if errorpublic int modify(java.lang.Object... parameters)
throws OperationException
parameters - operation parameters as objects (see setParameters(Object...))OperationException - if errorprotected void preExecute(R row) throws OperationException
setParameters(Object...) is used since no row is available.row - row for JDBC executeOperationException - if errorprotected void postExecute(R row) throws OperationException
setParameters(Object...) is used since no row is available.row - row for JDBC executeOperationException - if errorprotected void preExecuteCascade(R row) throws OperationException
row - row for JDBC executeOperationExceptionInsertCascade.post(),
UpdateCascade.post(),
SaveCascade.post(),
DeleteCascade.post()protected void postExecuteCascade(R row) throws OperationException
row - row for JDBC executeOperationExceptionInsertCascade.post(),
UpdateCascade.post(),
SaveCascade.post(),
DeleteCascade.post()protected void setRowsAffected(int rowsAffected)