Package ca.uhn.fhir.jpa.dao.tx
Interface IHapiTransactionService
- All Known Implementing Classes:
HapiTransactionService
,NonTransactionalHapiTransactionService
public interface IHapiTransactionService
This class is used to execute code within the context of a database transaction,
just like Spring's
TransactionTemplate
but with more functionality. It can auto-execute code upon rollback, it translates
specific exceptions, and it stores transaction context in a ThreadLocal.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
isCompatiblePartition
(RequestPartitionId theRequestPartitionId, RequestPartitionId theOtherRequestPartitionId) Are two RequestPartitionId values compatible within the same transaction?withRequest
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Fluent builder for creating a transactional callback<T> T
withRequest
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.annotation.Propagation thePropagation, org.springframework.transaction.annotation.Isolation theIsolation, ca.uhn.fhir.util.ICallable<T> theCallback) Deprecated.Fluent builder for internal system requests with no external requestdetails associatedConvenience for TX working with non-partitioned entities.withSystemRequestOnPartition
(RequestPartitionId theRequestPartitionId) Fluent builder for internal system requests with no externalRequestDetails
associated and a pre-specified partition ID.
-
Method Details
-
withRequest
IHapiTransactionService.IExecutionBuilder withRequest(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Fluent builder for creating a transactional callbackMethod chain must end with a call to
IHapiTransactionService.IExecutionBuilder.execute(Runnable)
or one of the other overloads oftask(...)
-
withSystemRequest
Fluent builder for internal system requests with no external requestdetails associated -
withSystemRequestOnPartition
default IHapiTransactionService.IExecutionBuilder withSystemRequestOnPartition(RequestPartitionId theRequestPartitionId) Fluent builder for internal system requests with no externalRequestDetails
associated and a pre-specified partition ID. This method is sugar forwithSystemRequest() .withRequestPartitionId(thePartitionId);
- Since:
- 6.6.0
-
withSystemRequestOnDefaultPartition
Convenience for TX working with non-partitioned entities. -
withRequest
@Deprecated(since="6.10") <T> T withRequest(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.annotation.Propagation thePropagation, @Nonnull org.springframework.transaction.annotation.Isolation theIsolation, @Nonnull ca.uhn.fhir.util.ICallable<T> theCallback) Deprecated.It is highly recommended to usewithRequest(RequestDetails)
instead of this method, for increased visibility. -
isCompatiblePartition
@Beta default boolean isCompatiblePartition(RequestPartitionId theRequestPartitionId, RequestPartitionId theOtherRequestPartitionId) Are two RequestPartitionId values compatible within the same transaction?This is an experimental API, subject to change in a future release.
- Since:
- 7.4.0
-
withRequest(RequestDetails)
instead of this method, for increased visibility.