Cypher results are computed as lazily as possible, so it needs to hold on to 
the KernelStatement for the transaction you queried through.
The KernelStatement is used for interfacing with the database through the 
transaction state.
Closing the transaction also closes the statement, so now any query results not 
consumed can no longer be computed.

--
Chris Vest
System Engineer, Neo Technology
[ skype: mr.chrisvest, twitter: chvest ]


> On 24 Nov 2015, at 17:15, Fry <[email protected]> wrote:
> 
> Thank you Michael and Chris.
> 
> That works.
> 
> Intuitively it makes sense as I guess you have to keep the entire chain of 
> operation under one transaction.
> 
> 
> What changed between neo4j versions or OSes for this to occur? (I have a lot 
> of code to check).
>  
> 
> Regards, John.
> 
> try ( Transaction tx = db.beginTx() ) {
> Iterator<Path> paths;
> paths = findShortestPathsCypher(db, icString[i], icString[j]); 
> while (paths.hasNext()){
> 
> 
> 
> On Tuesday, November 24, 2015 at 7:24:54 AM UTC-8, Michael Hunger wrote:
> you should move this into the transaction-block:
> 
> paths = findShortestPathsCypher(db, icString[i], icString[j]);
> 
> 
>> Am 24.11.2015 um 08:32 schrieb Fry <[email protected] <javascript:>>:
>> 
>> 
>> Hi All,
>> 
>> for the code below it works on one system and not another. The differences 
>> are:
>> Working system: OS X - neo4j-community-2.2.5
>> Broken system: Ubuntu - neo4j-communty-2.3.0
>> The code in red return returns an exception 
>> "org.neo4j.grapg.db.NotInTransactionException: The statement has been 
>> closed."
>> 
>> Has any one any experience with this of can offer advice/clues?
>> 
>> Many thanks, John.
>> 
>> 
>> 
>> Iterator<Path> paths;
>> 
>> paths = findShortestPathsCypher(db, icString[i], icString[j]);
>> 
>> try ( Transaction tx = db.beginTx() ) {
>> 
>>     while (paths.hasNext()){
>> 
>>     Path path = (Path) paths.next();
>> 
>>     Iterable<Node> nodes = path.nodes();
>> 
>>     java.util.Iterator<Node> nodeIterator = nodes.iterator();
>> 
>>     ShortestPath.clear(); 
>> 
>>     System.out.println(" ");
>> 
>>     boolean first = true;
>> 
>>     while (nodeIterator.hasNext()){
>> 
>>         Node n = nodeIterator.next();
>> 
>>         String nodeName = (String) n.getProperty("title");
>> 
>>      ShortestPath.add(nodeName);
>> 
>>      if (first) {
>> 
>>          System.out.print("Path: " + nodeName);
>> 
>>             first = false;
>> 
>>      } else
>> 
>>          System.out.print(" ->- " + nodeName);
>> 
>>      }
>> 
>>      AllShortestPaths.add((ArrayList<String>)ShortestPath.clone());
>> 
>>     }
>> 
>> } catch (Exception e) {
>> 
>>     System.out.println("Exception on path expansion: " + e.toString());
>> 
>>     e.printStackTrace();
>> 
>> }
>> 
>>                      
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to