Interface ITransaction
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
SimpleTransaction
public interface ITransaction extends java.lang.AutoCloseableSimple service interface which allows us to hide how transactions are managed for the current thread. In this framework, we're only dealing with a single database, and one connection per thread, so the implementation does not need to be complicated Implemented asAutoCloseableso the transaction will end when close is closed, making it nice and neat to use with try-with-resource.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Override theAutoCloseable.close()method so that we can refine the exceptionvoidsetRollbackOnly()Mark the transaction as failed, so that we we end it, we'll rollback
-
-
-
Method Detail
-
setRollbackOnly
void setRollbackOnly()
Mark the transaction as failed, so that we we end it, we'll rollback
-
close
void close() throws DataAccessExceptionOverride theAutoCloseable.close()method so that we can refine the exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
DataAccessException
-
-