Class Transaction

java.lang.Object
com.surrealdb.Native
com.surrealdb.Transaction

public class Transaction extends Native
Client-side transaction. Use Surreal.beginTransaction() to start a transaction. Operations (e.g. query(String)) run within the transaction until commit() or cancel() is called.
  • Method Details

    • commit

      public void commit()
      Commits the transaction. After this call, the transaction is completed and must not be used. On failure the native layer throws; the return value is only true on success.
    • cancel

      public void cancel()
      Cancels (rolls back) the transaction. After this call, the transaction is completed and must not be used. On failure the native layer throws; the return value is only true on success.
    • query

      public Response query(String sql)
      Runs a SurrealQL query within this transaction.
      Parameters:
      sql - the SurrealQL query
      Returns:
      the query response