Class TransactionMetadata


  • public class TransactionMetadata
    extends Object
    This class holds transaction metadata attributes.
    • Constructor Detail

      • TransactionMetadata

        public TransactionMetadata()
    • Method Detail

      • getPropagation

        public Propagation getPropagation()
        Get the propagation of the associated transaction.
        Returns:
        the Propagation instance.
      • setPropagation

        public void setPropagation​(Propagation propagation)
        Set the propagation of the associated transaction.
        Parameters:
        propagation - the Propagation instance.
      • isReadOnly

        public Boolean isReadOnly()
        Check if the associated transaction is read-only.
        Returns:
        true if read-only, false otherwise.
      • setReadOnly

        public void setReadOnly​(Boolean readOnly)
        Set if the associated transaction is read-only.
        Parameters:
        readOnly - true if read-only, false otherwise.
      • isRollbackOnParticipationFailure

        public Boolean isRollbackOnParticipationFailure()
        Check if the associated participating transaction should mark the whole transaction as rollback-only.
        Returns:
        true if it marks it as rollback-only, false otherwise.
      • setRollbackOnParticipationFailure

        public void setRollbackOnParticipationFailure​(Boolean rollbackOnParticipationFailure)
        Set if the associated participating transaction should mark the whole transaction as rollback-only.
        Parameters:
        rollbackOnParticipationFailure - true if it marks it as rollback-only, false otherwise.
      • getRollbackOn

        public Class<? extends Exception>[] getRollbackOn()
        Get the exception classes on which the associated transaction will be rollbacked.
        Returns:
        the exception classes array.
      • setRollbackOn

        public void setRollbackOn​(Class<? extends Exception>[] rollbackOn)
        Set the exception classes on which the associated transaction will be rollbacked.
        Parameters:
        rollbackOn - the exception classes array.
      • getNoRollbackFor

        public Class<? extends Exception>[] getNoRollbackFor()
        Get the exception classes on which the associated transaction will NOT be rollbacked.
        Returns:
        the exception classes array.
      • setNoRollbackFor

        public void setNoRollbackFor​(Class<? extends Exception>[] noRollbackFor)
        Set the exception classes on which the associated transaction will NOT be rollbacked.
        Parameters:
        noRollbackFor - the exception classes array.
      • getHandler

        public Class<? extends TransactionHandler> getHandler()
        Get the transaction handler of the associated transaction.
        Returns:
        the transaction handler class.
      • setHandler

        public void setHandler​(Class<? extends TransactionHandler> handler)
        Set the transaction handler of the associated transaction.
        Parameters:
        handler - the transaction handler class.
      • getResource

        public String getResource()
        Get the name of the transacted resource (must be unique per transaction handler).
        Returns:
        the name of the transacted resource.
      • setResource

        public void setResource​(String resource)
        Set the name of the transacted resource (must be unique per transaction handler).
        Parameters:
        resource - the name of the transacted resource.
      • getExceptionHandler

        public Class<? extends ExceptionHandler> getExceptionHandler()
        Get the exception handler of the associated transaction.
        Returns:
        the exception handler class.
      • setExceptionHandler

        public void setExceptionHandler​(Class<? extends ExceptionHandler> exceptionHandler)
        Set the exception handler of the associated transaction.
        Parameters:
        exceptionHandler - the exception handler class.
      • getMetadata

        public Object getMetadata​(String key)
        Get additional metadata.
        Parameters:
        key - the key of the metadata to retrieve.
        Returns:
        the value of the metadata.
      • addMetadata

        public void addMetadata​(String key,
                                Object value)
        Add additional metadata.
        Parameters:
        key - the key of the metadata to add.
        value - the value of the metadata to add.
      • mergeFrom

        public TransactionMetadata mergeFrom​(TransactionMetadata other)
        Merge this instance with another one, which has precedence (i.e. every non null attribute will override the corresponding one on this instance).
        Parameters:
        other - the instance to merge from.
        Returns:
        this instance, merged.
      • mergeFrom

        public TransactionMetadata mergeFrom​(Transactional other)
        Merge this instance with metadata defined in a Transactional annotation, which has precedence over this instance.
        Parameters:
        other - the annotation to merge from.
        Returns:
        this instance, merged.