Database Reference
In-Depth Information
7.2.2. Reading in a transaction and explicit read locks
Asyousawpreviously,readingvaluesfromthegraphreturnsthelatestcommittedvalue(or
the current modified state), which is equivalent to the Read Committed isolation level. The
following listing shows some code that reads a property on the node twice—the user's age
in this case—as part of a business operation, doing additional reading between the reads.
Listing 7.4. Reading the same thing twice without a transaction
Dependingonthetimetakentodothatotherprocessing,theremaybeasignificantwindow
during which external modifications might occur. If your code mixes a high number of
reads and writes, this might become an issue.
If you need a higher level of isolation to ensure that others can't change graph resources
you'rereading,Neo4joffersthepotentialfortheexplicitacquisitionofreadlocksongraph
resources. The following listing shows the same code, but this time with the addition of an
explicit request to acquire a read lock on the node prior to any property reading.
Search WWH ::




Custom Search