Class TransactionConfig

java.lang.Object
org.neo4j.driver.TransactionConfig
All Implemented Interfaces:
Serializable

public final class TransactionConfig extends Object implements Serializable
Configuration object containing settings for transactions. Instances are immutable and can be reused for multiple transactions.

Configuration is supported for:

Creation of configuration objects can be done using the builder API:

 
 Map<String, Object> metadata = new HashMap<>();
 metadata.put("type", "update user");
 metadata.put("application", "my application");

 TransactionConfig config = TransactionConfig.builder()
                 .withTimeout(Duration.ofSeconds(4))
                 .withMetadata(metadata)
                 .build();
 
 
See Also:
  • Method Details

    • empty

      public static TransactionConfig empty()
      Get a configuration object that does not have any values configures.
      Returns:
      an empty configuration object.
    • builder

      public static TransactionConfig.Builder builder()
      Create new TransactionConfig.Builder used to construct a configuration object.
      Returns:
      new builder.
    • timeout

      public Duration timeout()
      Get the configured transaction timeout.
      Returns:
      timeout or null when it is not configured.
    • metadata

      public Map<String,Value> metadata()
      Get the configured transaction metadata.
      Returns:
      metadata or empty map when it is not configured.
    • isEmpty

      public boolean isEmpty()
      Check if this configuration object contains any values.
      Returns:
      true when no values are configured, false otherwise.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object