db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Subject Re: Torque BaseXXX in Transaction and the isNew() Method Check
Date Sun, 17 Oct 2004 17:49:45 GMT
Hello Henning,

I would like to add a few notes to the transaction/rollback discussion
which we had a few weeks back.

-------- Original Message --------
Subject: Re: Torque BaseXXX in Transaction and the isNew() Method Check
Date: Mon, 27 Sep 2004 09:49:48 +0100
From: T E Schmitz <mailreg@numerixtechnology.de>
Reply-To: mailreg@numerixtechnology.de
To: Apache Torque Users List <torque-user@db.apache.org>

Good morning Henning,

Henning P. Schmiedehausen wrote:
>>What exactly do you mean by "lastState" property?
>>Do you mean a shadow object that allows youto fall back to the last 
>>saved state?
> 
> 
> No, no, much easier. Basically.
> 
> <snip>
> so if you have to roll back a transaction, you can do
> myObject.setNew(myObject.isLastNew());
> 
> And restore the "new" state of the object before a transaction. If you
> want complete rollback, then you would need a shadow object, right. I
> consider this outside the scope of Torque. 

To handle a rollback situation just resetting the isNew flag isn't
enough. The other thing that is changed after a successful INSERT are
the primary key properties. If you use SEQUENCEs the PK columns are null
prior to save and the are populated by doInsert(). Only upon successful
completion of the transaction can the new flag and PKs be set!

You would probably have to generate a confirm() method in Object.vm
which can be called after commit.

-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz



---------------------------------------------------------------------
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