Updated: 7/10/03; 2:39:47 PM.
BC4J Helper by Sung Im
Thoughts on how BC4J works, code samples, and other helpful techniques
        

Saturday, July 05, 2003

What Are Differences between Row.REFRESH_UNDO_CHANGES and Row.REFRESH_WITH_DB_FORGET_CHANGES

One of the main differences between the two refresh modes is the following: UNDO undoes changes you've made in this transaction--it backs out changes that may have been posted, but not yet committed.  FORGET simpy takes whatever is in the db and refreshes the row with it. Specifically, the two tables below show the differences in the row attr value (value in database and value in cache) between the two modes.  Let's say we start with the row attr value of "aaa."


UNDO CASE

Operation        Data in Table  Data in Cache
---------------  -------------  -------------
read into cache  aaa            aaa
setAttr(bbb)     aaa            bbb
postChanges()    bbb            bbb
setAttr(ccc)     bbb            ccc
refresh(UNDO)    bbb            aaa  <=== goes back to orig value "aaa"
 


FORGET CASE

 
Operation        Data in Table  Data in Cache
---------------  -------------  -------------
read into cache  aaa            aaa
setAttr(bbb)     aaa            bbb
postChanges()    bbb            bbb
setAttr(ccc)     bbb            ccc
refresh(FORGET)  bbb            bbb <=== goes back to latest db value "bbb"


UNDO goes back to the value at the beginning of trans. FORGET goes back to whatever is in db table at the time of
refresh call.

In terms of implementation, for UNDO, we keep the original (xtn relative) value in the cache row.  When you call refresh(UNDO), we push (using setAttr internally) the original values back into the row as if the user called setAttr of these attrs. The row is marked as MODIFIED, so that when you post, the original value ('aaa' in the above example) will go back out to database.

In constrast, after refresh(FORGET), the row will be marked as UNMODIFIED.


9:36:01 AM    comment []



© Copyright 2003 Sung Im.
 
July 2003
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
May   Aug


Click here to visit the Radio UserLand website.

Subscribe to "BC4J Helper by Sung Im" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.