On Thu, Apr 24, 2008 at 11:15 AM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> you need to surround your code with something like ths:
>
>
>  PlatformTransactionManager ptm = (PlatformTransactionManager)ctx
>            .getBean("transactionManager");
>
>  TransactionStatus txn = ptm.getTransaction(new 
> DefaultTransactionDefinition());
>
>  ...
>
>  ptm.commit/rollback(txn)

The problem with this approach is what do you do if the transaction
cannot commit (i.e. constraint violation) and you've already written
some data back to the response stream (you can't undo that)?  That's
why it's better to bundle up all that you want to do into a service
method and call that under one transactional umbrella.  Once that
completes, then you can go on and render the response.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to