tinkerpop/blueprints — pull request #465 by mikesname (2014-03-14 20:39:15+00:00)
Title: Iterable auto-start transactions...

The immediate rationale for this PR is that certain Neo4j2 iterables access the underlying graph without automatically starting a transaction (as do other methods on the graph). This scenario was encountered in situations like the following web-service type example:

```java
@Path("/someResource")
public StreamingResponse getStuff() {
try {
return streamingListOfStuff(graph.getVertices());
} finally {
graph.getBaseGraph().commit();
}
}
```
While the `getVertices()` method triggered an auto-start TX, it returned an iterable that when iterated triggered a `NotInTransaction` error if the `streamingListOfStuff` method doesn't explicitly call `graph.autoStartTransaction(false)` before handling the resource.

**However**, I have doubts that this should be merged as-is. IMHO, if an iterable has some resources attached (i.e. having to close a TX) it should be explicit in the type system, as with `CloseableIterable`. But that would presumably require many more changes. Perhaps someone from Neo4j could advise as to how they handle laziness with read transactions.