Annotation Type Transaction


  • @Retention(RUNTIME)
    @Target({METHOD,TYPE})
    public @interface Transaction
    Causes the annotated method to be run in a transaction.

    Nested @Transaction annotations (e.g. one method calls another method, where both methods have this annotation) are collapsed into a single transaction. If the outer method annotation specifies an isolation level, then the inner method must either specify the same level, or not specify any level.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean readOnly
      Set the connection readOnly property before the transaction starts, and restore it before it returns.
      TransactionIsolationLevel value  
    • Element Detail

      • value

        TransactionIsolationLevel value
        Returns:
        the transaction isolation level. If not specified, invoke with the default isolation level.
        Default:
        org.jdbi.v3.core.transaction.TransactionIsolationLevel.UNKNOWN
      • readOnly

        boolean readOnly
        Set the connection readOnly property before the transaction starts, and restore it before it returns. Databases may use this as a performance or concurrency hint.
        Returns:
        whether the transaction is read only
        Default:
        false