db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henning P. Schmiedehausen" <...@intermeta.de>
Subject Re: Torque BaseXXX in Transaction and the isNew() Method Check
Date Mon, 27 Sep 2004 08:04:06 GMT
T E Schmitz <mailreg@numerixtechnology.de> writes:

>Hallo Henning,

>Henning P. Schmiedehausen wrote:

>> Well, it might be a good idea to add a "lastState" property to the
>> generated peer classes...

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

private boolean isNew = false;
private boolean lastNew = false;

public void setNew(boolean isNew)
	this.lastNew = this.isNew;
	this.isNew = isNew;

public boolean isNew()
	return isNew;

public boolean isLastNew()
	return lastNew;

so if you have to roll back a transaction, you can do


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. 

>Correct me if I am wrong but I think there is another pitfall regarding 
>the modified flag: in doUpdate(...) the modified flag is set to false 
>unless an exception was thrown. But as there is no feedback whether the 
>update was actually successful it is possible for the flag to be set 
>without the update having been carried out. (The record might've been 
>deleted in the meantime or modified such that the criteria didn't grab 
>the record).

Could be, yes. I've not ventured deep inside the Peer/Object logic,
mainly because my stomach gets upset. ;-)


Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Fighting for one's political stand is an honorable action, but re-
 fusing to acknowledge that there might be weaknesses in one's
 position - in order to identify them so that they can be remedied -
 is a large enough problem with the Open Source movement that it
 deserves to be on this list of the top five problems."
                       -- Michelle Levesque, "Fundamental Issues with
                                    Open Source Software Development"

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

View raw message