ADM2: When does a SmartDataObject re-read data from the database?

moveIT

New Member
In the White Paper document "Building and Using SDOs" from John Sadd (March 2000) is written that after the execution of procedure endTransactionValidate all updated and added rows are re-read from the database, to capture changes made by database triggers or other code. So running procedure postTransactionValidate the RowObjUpd record must be equal to the database record. Not In my case!
I debugged the code (Progress 9.1D07) between procedure endTrans.. and postTrans.. and I could not find the code where the data is re-read as described in the document. So where are updated or added records are re-read, to capture changed fields by a trigger?

My Problem:
I have a SDO against a TempTable so the TempTable is my database. Before running endTransactionValidate all changes are written from the RowObjUpd record to the TempTable record which is correct (ADM2 standard behavior). Than I manually write this changes from the TempTable to the database where a trigger changes some fields of the record in the database. Than I manually re-read this changes to the TempTable record to capture them. Now I thougth that this actual TempTable record is re-read by the SDO between endTrans.. and postTrans.. . But they differ, because the data is not re-read by ADM2 standard behavior. Next updates with this SDO record fail because the records now differ by the trigger changed fields (Error: Record was changed by antoher user ...). So I wrote some code in postTransactionValidate where I update the RowObjUpd record with the actuall TempTable record and this works.
But where is this standard ADM2 behavior?
Thx!
 
With help from Progress Tech Support now I found my misunderstanding!
I always thought that the updated and added records are wirtten to the db (in my case to the temp table) after running beginTransactionValidate. Then procedure endTransactionValidate is executed and after endTransactionValidate the records are re-read from the db (temp-table). This is wrong!
Between beginTransactionValidate and endTransactionValidate both is done, writing changes to the db and re-reading them from the db.

This also explains the problem with my SDO against the temp table:
I placed the code to save records from the updated temp table into the db in endTransantionValidate, were I also re-read the temp table from the db to catch my changes through the trigger. Now I thougth that after endTrans... the sdo re-reads this updated records from the temp table. This was my misunderstanding.

So I have to place the code to write the temp table record to the db in assignDBRow after RUN SUPER and I have to update the temp table record with the db (to catch the trigger changes) in refetchDBRow bevore RUN SUPER.

Thanks to Progress Tech Support!
 
Back
Top