db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Problems with rollback
Date Tue, 10 Oct 2006 15:25:26 GMT
Hi Tobias,

"Tobias Hilka" <thilka@vps.de> schrieb am 10.10.2006 16:14:28:

> Hello everyone,
>
> We have some problems rolling back transactions.
> Torque has the two flags "new" and "modified" to hold the state of the
> instance of the T-class (subclass of BaseObject). These two flags are
reset
> upon saving the record. Our problem is: If something goes wrong later on
in
> the same transaction, we want to roll back all changes that were
performed.
> So we want these two flags to be the same as before the save as well. But
it
> seems that Torque does not touch these two flags upon rollback. If we try
to
> save the same object again (after fixing the reason for rollback), these
two
> flags are not set and therefore the object (which is not yet stored in
db)
> is not stored in database.

This is the behaviour I'd expect from Torque. A rollback is left to the DB,
no rollback af any kind in memory is performed.

>
> Is there any elegant solution for this problem? We were thinking of
holding
> the state of all involved T-objects in some state object and restore the
> state upon rollback.

Just a quick thought : This is quite difficult, actually. You can do more
than one save in a transaction. So you would need to keep track of the
changes in the connection, probably, doing that in the save method is not
enough. This would mean that Torque would not pass around a connection, but
a wrapper to a connection with the additional info, and keep all modified
objects in the wrapper.

Then you could modify an object, save it to your transaction, then modify
it again, and saving it to another transaction (this will work for
non-serializable transactions), and then rolling back the original
transaction. I do not know an consistent behaviour for that. The problem is
that in Torque, an object is not associated to a certain transaction.

To sum up: I am not sure whether a good solution is avaliable within the
Torque architecture at all.

   Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message