org.neo4j.kernel.api
Interface TransactionContext


public interface TransactionContext

Represents a transaction of changes to the underlying graph. Actual changes are made in the statements created from this transaction context. Changes made within a transaction are visible to all operations within it. Usage of a transaction context:

  1. get a statement and use it
  2. in a finally-block: close the statement context
  3. (do these above two an arbitrary number of times)
  4. call #success() if all statements were successful
  5. call #finish() to commit (if #success() has been called) or roll back (if #success() hasn't or #failure() has been called


Method Summary
 void commit()
          Commit this transaction, this will make the changes in this context visible to other transactions.
 StatementContext newStatementContext()
          Creates a new statement which operations can be performed on.
 void prepare()
          Writes the changes this transaction wants to perform down to disk.
 void rollback()
          Roll back this transaction, undoing any changes that have been made.
 

Method Detail

newStatementContext

StatementContext newStatementContext()
Creates a new statement which operations can be performed on. When done it must be closed.

Returns:
a new StatementContext to do operations on.

prepare

void prepare()
Writes the changes this transaction wants to perform down to disk. If this method returns successfully, the database guarantees that we can recover this transaction after a crash. Normally, you should not use this, it is implicitly called by commit(), but it is a necessary thing if you are implementing two-phase commits.


commit

void commit()
Commit this transaction, this will make the changes in this context visible to other transactions. If you have not called prepare() before calling this method, the transaction is implicitly prepared.


rollback

void rollback()
Roll back this transaction, undoing any changes that have been made.



Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.