Class TransactionConfig.Builder

java.lang.Object
org.neo4j.driver.TransactionConfig.Builder
Enclosing class:
TransactionConfig

public static final class TransactionConfig.Builder extends Object
Builder used to construct transaction configuration objects.
  • Method Details

    • withTimeout

      public TransactionConfig.Builder withTimeout(Duration timeout)
      Set the transaction timeout. Transactions that execute longer than the configured timeout will be terminated by the database. See also withDefaultTimeout().

      This functionality allows to limit query/transaction execution time. Specified timeout overrides the default timeout configured in the database using dbms.transaction.timeout setting.

      Provided value should not represent a negative duration.

      Parameters:
      timeout - the timeout.
      Returns:
      this builder.
    • withDefaultTimeout

      public TransactionConfig.Builder withDefaultTimeout()
      Set the transaction timeout to the server-side configured default timeout. This is the default behaviour if withTimeout(java.time.Duration) has not been called. See also withTimeout(java.time.Duration).
      Returns:
      this builder.
    • withMetadata

      public TransactionConfig.Builder withMetadata(Map<String,Object> metadata)
      Set the transaction metadata. Specified metadata will be attached to the executing transaction and visible in the output of dbms.listQueries and dbms.listTransactions procedures. It will also get logged to the query.log.

      This functionality makes it easier to tag transactions and is equivalent to dbms.setTXMetaData procedure.

      Provided value should not be null.

      Parameters:
      metadata - the metadata.
      Returns:
      this builder.
    • build

      public TransactionConfig build()
      Build the transaction configuration object using the specified settings.
      Returns:
      new transaction configuration object.