java.lang.Object
java.lang.Record
st.orm.TransactionOptions
- Record Components:
propagation- how the block relates to an already active transaction.isolation- the isolation level.timeoutSeconds- the transaction timeout in seconds.readOnly- whether the transaction is read-only.
public record TransactionOptions(TransactionPropagation propagation, TransactionIsolation isolation, Integer timeoutSeconds, Boolean readOnly)
extends Record
Options for a transactional block. A
null component means the option is inherited from the
surrounding defaults: the thread-scoped options, then the global options, then the baseline
(TransactionPropagation.REQUIRED, provider-default isolation and timeout, read-write).- Since:
- 1.13
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionOptions(TransactionPropagation propagation, TransactionIsolation isolation, Integer timeoutSeconds, Boolean readOnly) Creates an instance of aTransactionOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic TransactionOptionsdefaults()Options with every field inherited from the surrounding defaults.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theisolationrecord component.Returns the value of thepropagationrecord component.readOnly()Returns the value of thereadOnlyrecord component.Returns the value of thetimeoutSecondsrecord component.final StringtoString()Returns a string representation of this record class.withIsolation(TransactionIsolation isolation) withPropagation(TransactionPropagation propagation) withReadOnly(boolean readOnly) withTimeoutSeconds(int timeoutSeconds)
-
Constructor Details
-
TransactionOptions
public TransactionOptions(TransactionPropagation propagation, TransactionIsolation isolation, Integer timeoutSeconds, Boolean readOnly) Creates an instance of aTransactionOptionsrecord class.- Parameters:
propagation- the value for thepropagationrecord componentisolation- the value for theisolationrecord componenttimeoutSeconds- the value for thetimeoutSecondsrecord componentreadOnly- the value for thereadOnlyrecord component
-
-
Method Details
-
defaults
Options with every field inherited from the surrounding defaults. -
withPropagation
-
withIsolation
-
withTimeoutSeconds
-
withReadOnly
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
propagation
Returns the value of thepropagationrecord component.- Returns:
- the value of the
propagationrecord component
-
isolation
Returns the value of theisolationrecord component.- Returns:
- the value of the
isolationrecord component
-
timeoutSeconds
Returns the value of thetimeoutSecondsrecord component.- Returns:
- the value of the
timeoutSecondsrecord component
-
readOnly
Returns the value of thereadOnlyrecord component.- Returns:
- the value of the
readOnlyrecord component
-