Package org.alfresco.repo.domain.control
Interface ControlDAO
-
- All Known Implementing Classes:
AbstractControlDAOImpl,ControlDAOImpl,ControlDAOImpl.PostgreSQL
public interface ControlDAODAO services for database control statements. It is sometimes necessary to issue control statements on a database connection; these are not usually supported in the ANSI SQL standard.- Since:
- 3.2SP1
- Author:
- Derek Hulley
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.sql.SavepointcreateSavepoint(java.lang.String savepoint)Create a "Save Point" in the current transaction, for later selective rollback.voidexecuteBatch()Execute statements that were queued for batching.voidreleaseSavepoint(java.sql.Savepoint savepoint)Remove a previously-created "Save Point", writing any intervening updates into the current transaction.voidrollbackToSavepoint(java.sql.Savepoint savepoint)Roll back to a previously-created "Save Point", discarding any intervening changes to the current transaction.intsetTransactionIsolationLevel(int isolationLevel)Change the current transaction isolation level.voidstartBatch()Begin batching prepared statements for later execution.
-
-
-
Method Detail
-
startBatch
void startBatch()
Begin batching prepared statements for later execution.- See Also:
executeBatch()
-
executeBatch
void executeBatch()
Execute statements that were queued for batching.- See Also:
startBatch()
-
createSavepoint
java.sql.Savepoint createSavepoint(java.lang.String savepoint)
Create a "Save Point" in the current transaction, for later selective rollback. Creation must be accompanied by a matchingrollbackToSavepoint(Savepoint)orreleaseSavepoint(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 ... }- Parameters:
savepoint- the name of the save point- Returns:
- Returns the handle to the savepoint or null if the implementation does not support it
-
rollbackToSavepoint
void rollbackToSavepoint(java.sql.Savepoint savepoint)
Roll back to a previously-created "Save Point", discarding any intervening changes to the current transaction.- Parameters:
savepoint- a previously-created savepoint- See Also:
createSavepoint(String)
-
releaseSavepoint
void releaseSavepoint(java.sql.Savepoint savepoint)
Remove a previously-created "Save Point", writing any intervening updates into the current transaction.- Parameters:
savepoint- the name of the save point- See Also:
createSavepoint(String)
-
setTransactionIsolationLevel
int setTransactionIsolationLevel(int isolationLevel)
Change the current transaction isolation level. Note: The isolation level should not - and for some DBs, cannot - be changed except at the very start of the transaction- Parameters:
isolationLevel- the transaction isolation level- Returns:
- Returns the previously-set isolation
- Throws:
java.lang.IllegalStateException- if the isolation level is invalid or cannot be changed
-
-