Interface FHIRPersistenceTransaction
-
- All Known Implementing Classes:
FHIRTestTransactionAdapter
,FHIRUserTransactionAdapter
public interface FHIRPersistenceTransaction
This interface represents a transaction within the FHIR persistence layer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
begin()
Begin a new transaction on the current thread if a transaction is not started yet.void
end()
End the current thread's transaction.boolean
hasBegun()
Determine if the transaction status is currently activedefault boolean
isTransactional()
Does the underlying implementation actually support transactions? A persistence layer must always return a FHIRPersistenceTransaction even if it doesn't support transactions.void
setRollbackOnly()
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
-
-
-
Method Detail
-
isTransactional
default boolean isTransactional()
Does the underlying implementation actually support transactions? A persistence layer must always return a FHIRPersistenceTransaction even if it doesn't support transactions. This reduces boilerplate code by avoiding the need to check for null every time.- Returns:
-
begin
void begin() throws FHIRPersistenceException
Begin a new transaction on the current thread if a transaction is not started yet.- Throws:
java.lang.Exception
FHIRPersistenceException
-
end
void end() throws FHIRPersistenceException
End the current thread's transaction. If setRollbackOnly has been called, then roll back the transaction instead. This call only affects the current transaction if this object actually started the transaction (i.e. is the outermost instance of a transaction).- Throws:
java.lang.Exception
FHIRPersistenceException
-
setRollbackOnly
void setRollbackOnly() throws FHIRPersistenceException
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.- Throws:
FHIRPersistenceException
-
hasBegun
boolean hasBegun() throws FHIRPersistenceException
Determine if the transaction status is currently active- Returns:
- true if transaction begin has been called
- Throws:
FHIRPersistenceException
-
-