Ignoring any external transaction management done by the container, I kept seeing recommendations that in the majority of cases when handling a http request (like in a REST API) the transaction should be started before you actually start to handle the request and committed just after you finish handling the request.
The (naive) implementation i showed is about the same thing for ORBroker. The nice thing is that then you don't have to nest yourself the code in a transactional and can just use the session in your code.
However, it seems to me that in some cases the transaction is opened much longer than would be actually required. That's why I was looking for other opinions if we should in fact use this.
On Thursday, 2 August 2012 17:10:34 UTC+1, Nils Kilden-Pedersen wrote:
I'm not sure I understand the purpose of the implementation. However for external transaction management, the idea is to use Broker.transactional(java.sql.Connection), which leaves commit and rollback to any external transaction manager.