Package org.alfresco.repo.domain.control
Interface ControlDAO
- All Known Implementing Classes:
AbstractControlDAOImpl,ControlDAOImpl,ControlDAOImpl.PostgreSQL
public interface ControlDAO
DAO 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
Modifier and TypeMethodDescriptioncreateSavepoint(String savepoint) Create a "Save Point" in the current transaction, for later selective rollback.voidExecute statements that were queued for batching.voidreleaseSavepoint(Savepoint savepoint) Remove a previously-created "Save Point", writing any intervening updates into the current transaction.voidrollbackToSavepoint(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.voidBegin batching prepared statements for later execution.
-
Method Details
-
startBatch
void startBatch()Begin batching prepared statements for later execution.- See Also:
-
executeBatch
void executeBatch()Execute statements that were queued for batching.- See Also:
-
createSavepoint
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
Roll back to a previously-created "Save Point", discarding any intervening changes to the current transaction.- Parameters:
savepoint- a previously-created savepoint- See Also:
-
releaseSavepoint
Remove a previously-created "Save Point", writing any intervening updates into the current transaction.- Parameters:
savepoint- the name of the save point- See Also:
-
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:
IllegalStateException- if the isolation level is invalid or cannot be changed
-