public interface ControlDAO
Modifier and Type | Method and Description |
---|---|
Savepoint |
createSavepoint(String savepoint)
Create a "Save Point" in the current transaction, for later selective rollback.
|
void |
executeBatch()
Execute statements that were queued for batching.
|
void |
releaseSavepoint(Savepoint savepoint)
Remove a previously-created "Save Point", writing any intervening updates
into the current transaction.
|
void |
rollbackToSavepoint(Savepoint savepoint)
Roll back to a previously-created "Save Point", discarding any intervening
changes to the current transaction.
|
int |
setTransactionIsolationLevel(int isolationLevel)
Change the current transaction isolation level.
|
void |
startBatch()
Begin batching prepared statements for later execution.
|
void startBatch()
executeBatch()
void executeBatch()
startBatch()
Savepoint createSavepoint(String savepoint)
rollbackToSavepoint(Savepoint)
or releaseSavepoint(Savepoint)
.
Savepoint savepoint = controlDAO.createSavepoint("functionF");
try
{
// Do something that could fail e.g. blind insert that might violate unique constraints
...
// Success, so remove savepoint or risk crashing on long-running transactions
controlDAO.releaseSavepoint(savepoint);
}
catch (Throwable e)
{
controlDAO.rollbackToSavepoint(savepoint);
// Throw something that client code might be able to react to or try something else
...
}
savepoint
- the name of the save pointvoid rollbackToSavepoint(Savepoint savepoint)
savepoint
- a previously-created savepointcreateSavepoint(String)
void releaseSavepoint(Savepoint savepoint)
savepoint
- the name of the save pointcreateSavepoint(String)
int setTransactionIsolationLevel(int isolationLevel)
isolationLevel
- the transaction isolation levelIllegalStateException
- if the isolation level is invalid or cannot be changedCopyright © 2005–2017 Alfresco Software. All rights reserved.