I have a data grid in which the user selects multiple columns. The data grid is mapped to a table where each row in the grid is a row in the Data Table.
When the user selects multiple rows and submits the form, I want to update the Status of all selected items to the same status.
So far, I can only think of taking the selected list of objects and running an individual update() on the object to update to the new status.
Is there a better or faster way to process all selected objects in a single call or transaction? (similar to what you can do with a SQL statement?)
So to clarify, if I have 5 rows (objects) where I need to update the Status column, will the decorated function hit the database 5 times, in a transaction, or does it batch up all 5 updates in a single call to the db.
It will be 5 different updates inside the same transaction.
This is not a problem if you execute the 5 updates in one server side function, it is very slow if you do it from the client side.
It could actually be even more than 5 sql commands if you update more than one field per row. Here are two ways to do the same, the first does it in 3 commands, the second in 1: