> -----Original Message----- > From: Victor Gomez [mailto:[EMAIL PROTECTED] > Sent: Monday, March 28, 2005 2:31 PM > To: MyFaces Discussion > How do you leverage the x:saveState(or preserveModel) functionality? > I have an application that just adds record to a DB and keeps > a table (x:datatable) updated with those db records. > Should I preserve the state of the x:datatable(maintaining it > every time a record is added) or should I be reading the db > every time I add a record and repopulating the x:datatable? > What is best?
Depends on a lot of factors, but generally, it is less expensive to avoid reading the database. So when you do an update/insert, you just need to make sure you are updating your data object too, then keep the the object "alive" with x:saveState. x:datatable is only a UI element for displaying the data, so it's repopulated either with the data from db or from data saved with x:savedState. Kalle