On 12/31/2013 04:12 PM, M. David Allen wrote:
> Just curious, what's the thinking behind requiring transactions for reads?
Since nobody else answered yet I'll take a stab at it :-)
As far as I know the reason for requiring transaction for read
operations is optimization: fetched resources can be released after the
transactional context has been closed. A nice side-effect is
consistency: your read operations will be unaffected by write
transactions that are going on in parallel.
<
http://docs.oracle.com/javase/7/docs/api/java/lang/RuntimeException.html?is-external=true>
>
> Thrown when attempting to modify the graph outside of a transaction.
>
Thanks for catching that, the docs have been updated but that spot has
been missed. I have opened a pull request for an update of that JavaDoc
which has already been merged.
> Finally, I noticed that with 2.0, apparently the code wants you to use
> try/with, instead of try/finally, e.g.
>
> |try ( Transaction tx = graphDb.beginTx() ) { blah(); }
>
> I'm also curious about that decision, since it requires I choose between looking
> at deprecation warnings on my use of tx.finish() or trying to upgrade all my
> developer's IDEs to java7 code style compliance.
I like the reduction of redundant code this change brings, but then
again, I don't have a migrate a (big) code base too it ;-)
Johannes
> On Tuesday, December 31, 2013 10:07:08 AM UTC-5, Michael Hunger wrote:
>
> Hi
>
> Read operation on the database and nodes and relationships now
> require transactions
>
> Probably most sensible to wrap the tx around the entry point to your
> service layer.
>
> HTH
>
> Michael
>
> Sent from mobile device
>
> Am 31.12.2013 um 15:53 schrieb "M. David Allen" <
allen....@gmail.com
> <javascript:>>:
>> send an email to
neo4j+un...@googlegroups.com <javascript:>.
>> <
https://groups.google.com/groups/opt_out>.