Declarative Transactions in Node.js
- by James Kingsbery
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?