Class FHIRTransactionHelper
- java.lang.Object
 - 
- org.linuxforhealth.fhir.persistence.helper.FHIRTransactionHelper
 
 
- 
public class FHIRTransactionHelper extends java.lang.ObjectThis helper class is used to manage the transaction on the current thread. 
- 
- 
Constructor Summary
Constructors Constructor Description FHIRTransactionHelper(FHIRPersistenceTransaction txn) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()If a transaction has not yet been started on this thread, then start one.voidcommit()If we previously started a transaction on this thread using this helper instance, then commit it now.voidend()Same as commit, but is preferred for readability becausecommit()will actually do a rollback if setRollbackOnly is called on the underlying transactionbooleanhasBegun()Find out if we're currently in a transactionvoidrollback()If we previously started a transaction on this thread using this helper instance, then perform a rollback now; otherwise, set the transaction as 'rollback only' to prevent it from being committed later.voidsetRollbackOnly()Mark the current transaction for rollback. 
 - 
 
- 
- 
Constructor Detail
- 
FHIRTransactionHelper
public FHIRTransactionHelper(FHIRPersistenceTransaction txn)
 
 - 
 
- 
Method Detail
- 
begin
public void begin() throws FHIRPersistenceExceptionIf a transaction has not yet been started on this thread, then start one.- Throws:
 FHIRPersistenceException
 
- 
commit
public void commit() throws FHIRPersistenceExceptionIf we previously started a transaction on this thread using this helper instance, then commit it now.- Throws:
 FHIRPersistenceException
 
- 
end
public void end() throws FHIRPersistenceExceptionSame as commit, but is preferred for readability becausecommit()will actually do a rollback if setRollbackOnly is called on the underlying transaction- Throws:
 FHIRPersistenceException
 
- 
rollback
public void rollback() throws FHIRPersistenceExceptionIf we previously started a transaction on this thread using this helper instance, then perform a rollback now; otherwise, set the transaction as 'rollback only' to prevent it from being committed later.- Throws:
 FHIRPersistenceException
 
- 
setRollbackOnly
public void setRollbackOnly() throws FHIRPersistenceExceptionMark the current transaction for rollback.- Throws:
 FHIRPersistenceException
 
- 
hasBegun
public boolean hasBegun() throws FHIRPersistenceExceptionFind out if we're currently in a transaction- Returns:
 - Throws:
 FHIRPersistenceException
 
 - 
 
 -