[Seaside] More transaction rambling
Cees de Groot
seaside@lists.squeakfoundation.org
Sat, 06 Jul 2002 15:54:09 +0200
Avi Bryant wrote:
>
> BEGIN (start shopping)
> BEGIN (get user account info)
> COMMIT (user account info)
>
> BEGIN (fill shopping cart)
> COMMIT (shopping cart)
> COMMIT (shopping trip)
>
Wrong.
BEGIN (shopping)
fill shopping cart
...
on checkout: BEGIN(get user account info)
COMMIT(get user account inf)
create order
COMMIT (shopping)
As you can see, with independent transactions, 'create order' will never
see the user account info. This, of course, assumes that you want to do
it all in one transaction (I do, certainly for discussion's sake ;-)).
Of course, a solution would be: TXN 1: shopping, on checkout commit
shopping cart -> TXN 2: get user info, on completion commit (if
necessary) -> TXN 3: create order. But as people often play with a shop
and stop inside of just before TXN 2 (where it gets serious), this
leaves you with shopping carts in your database...