Neo4j: Exception handling and explict invoking of failure()/close()? -


i trying handle exceptions in neo4j try transaction.

try(transaction tx = graphdb.begintx()) {     // more code     tx.sucess(); } 

the code posted standard, keeps transaction in variable tx , upon end of try block tx.close() automatically called.

hows 1 handle exceptions in type of block? know following works:

transaction tx = graphdb.begintx(); try{     // more code     tx.sucess(); // must called } catch(exception e) {     tx.failure(); // exception arised, best call this. } {     tx.close(); // tx.close called automatically, or must call did here? } 

so have 2 questions, first sample of code: how 1 handle exceptions in one? second sample of code: must call explicitly , automatically called?

simply add exception handling, omit finally:

try(transaction tx = graphdb.begintx()) {     // more code     tx.sucess(); } catch(exception e) {     // .. } 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -