title: Nested transactions in Neo4j
body: <p>For the record, I am using Neo4j 2.0.0-M02.</p>
  
  <p>I currently have a method which can search nodes with the label "User" on their user id which is stored in the graph as a node property "id". This all happens in a transaction, as that automatically closes the ResourceIterator.</p>
  
  <p>Now, I want to create a relationship between two users. All I have is their user id. Now, I would obviously like to reuse the method which searches users by their id. And there are three ways I can think of.</p>
  
  <p>The first one is the obvious one. Retrieve the two nodes with the already existing method. Than call the method that creates the relationship between them. Obviously this happens in a transaction as well so this would require three transactions. Not that efficient.</p>
  
  <p>The second one is just to reuse the code (not the method) in the new method that creates the relationship. This way, I can do it all in one transaction, but I am duplicating code which isn't really good practice for developers.</p>
  
  <p>A third one is to call the existing method twice inside the transaction of the new method that creates the relationship. That way my code is still reusable, but I am not sure how nested transactions work in Neo4J. Would the transactions from the existing method be ignored because there already is an existing transaction? That would solve my problem.</p>
  
  <p>If not, I have to rethink where I manage my transactions. I know it's normally better to manage them in the services than in the DAO's but I'd like to keep Neo4j stuff out of my service classes.</p>