i completely agree. but i guess his usecase doesnt allow that...
also having a service for grouping a ui-driven usecase is kinda silly,
it has nothing to do with the business tier. we use salve at my day
job, and salve lets you @Transactional link's onclick() to unite
everything that happens inside that onclick into a single transaction.
makes life much easier.
-igor
On Thu, Apr 24, 2008 at 8:25 AM, James Carman
<[EMAIL PROTECTED]> wrote:
> 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]