Reputation: 25770
Are there any benefits of using Spring @Transactional(readOnly = true)
with Neo4j/Neo4j Spring Data ? Should I mark readonly transactions as @Transactional(readOnly = true)
or not ?
Upvotes: 3
Views: 686
Reputation: 898
Transactions marked as readonly are routed to the follower / read-replica nodes in Neo4j. This reduces the load on the leader node(s), allowing them to better serve Write queries.
Upvotes: 2
Reputation: 15076
Since SDN 4.2 (4.2.RC1 at the time of writing) you can use read only transactions.
As of SDN 4.2 you can also define read only transactions.
You can start a read only transaction by marking a class or method with @Transactional(readOnly=true).
http://docs.spring.io/spring-data/data-neo4j/docs/4.2.x/reference/html/#_read_only_transactions
Upvotes: 3