Declarative Transactions in Node.js

Posted by James Kingsbery on Programmers See other posts from Programmers or by James Kingsbery
Published on 2014-06-06T18:50:53Z Indexed on 2014/06/06 21:48 UTC
Read the original article Hit count: 358

Filed under:
|

Back in the day, it was common to manage database transactions in Java by writing code that did it. Something like this:

Transaction tx = session.startTransaction();
...
try {
   tx.commit();
} catch (SomeException e){
   tx.rollback();
}

at the beginning and end of every method. This had some obvious problems - it's redundant, hides the intent of what's happening, etc. So, along came annotation-driven transactions:

@Transaction
public SomeResultObj getResult(...){

    ...
}

Is there any support for declarative transaction management in node.js?

© Programmers or respective owner

Related posts about java

Related posts about node.js