Database Reference
In-Depth Information
Chapter 7. Transactions
This chapter covers
• Why transactions are important
• How Neo4j handles transactions
• How to integrate Neo4j with other transaction management systems
• How to take advantage of transaction events
Neo4j differs from some other NoSQL technologies by being fully ACID-compliant (ACID
being an acronym for atomic, consistent, isolated, durable). Being fully ACID-compliant
means Neo4j offers the same guarantees you'd have if you were working with a traditional
relational database system.
It's important to have ACID guarantees when you work with Neo4j because it's common-
place to mutate a number of graph entities (nodes, relationships, and index entries) within
the same transaction. It's also easier to reason about the behavior of systems that are ACID-
compliant compared to eventually consistent systems, where you have no real guarantees
about when your changes will be visible across a cluster, and compared to technologies
where there are no transactions and therefore partial results of a larger business operation
may become temporarily visible to competing transactions. The durability aspect of ACID
transactions also provides a high degree ofconfidence that once yourtransaction is commit-
ted, the data won't be lost.
You've seen transactions being called in other chapters in this topic. In this chapter we'll
explore transactions in more detail.
7.1. Transaction basics
First, let's examine the idiomatic way of programmatically creating transactions in Neo4j,
as shown in the following snippet:
try (Transaction tx = graphDatabaseService.beginTx()) {
//do something with the database
tx.success();
}
Search WWH ::




Custom Search