Interface ITransaction
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
SimpleTransaction
public interface ITransaction extends java.lang.AutoCloseable
Simple 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 asAutoCloseable
so 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 void
close()
Override theAutoCloseable.close()
method so that we can refine the exceptionvoid
setRollbackOnly()
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 DataAccessException
Override theAutoCloseable.close()
method so that we can refine the exception- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
DataAccessException
-
-