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. The reason for the separation between transactions and statements is isolation levels. While Neo4j is read-committed isolation, a read can potentially involve multiple operations (think of a cypher statement). Within that read, or statement if you will, the isolation level should be repeatable read, not read committed. Clearly separating between the concept of a transaction and the concept of a statement allows us to cater to this type of isolation requirements.


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.