Package tech.ydb.yoj.repository.db
Interface RepositoryTransaction
public interface RepositoryTransaction
A DB transaction. Each instance <must be closed with
commit() or rollback() methods (exactly
one call to either method) lest your transaction stays active on the DB server.-
Method Details
-
table
-
commit
Commits the transaction or throws exception. Note that this method is not expected to be called, if the last transaction statement has thrown an exception, because it means that transaction didn't 'execute normally'.- Throws:
OptimisticLockException- if the transaction's optimistic attempt has failed and it ought to be started over
-
rollback
Rollbacks that transaction. This method must be called in the end unlesscommit()method was chosen for calling. If this method throws an exception, the transaction consistency is not confirmed and none of its results can be used (you may very well be inside a catch clause right now, having caught an exception from your transaction and calling the rollback method on this occasion; even so, your exception is a result of your transaction and it must be disregarded, because the consistency couldn't be confirmed). If the thrown exception isOptimisticLockException, the transaction is certainly inconsistent and ought to be started over. Otherwise it's at your discretion whether to restart the transaction or simply to fail the operation.(Note, that consistency is only checked if the transaction has 'executed normally', i.e. the last statement didn't throw an exception. Otherwise this method always completes normally.)
- Throws:
OptimisticLockException
-
getTransactionLocal
TransactionLocal getTransactionLocal() -
getOptions
TxOptions getOptions()
-