Update Operation

The updateUpdate operation updates a record in the local database on the device. To execute update operations on an MBO, get an instance of the MBO, set the MBO attributes, then call either the save()Save() or update()Update() operation. To propagate the changes to the server, call submitPendingSubmitPending.

If there are previous non-default Create/Update/Delete operations pending for an object, and submitPending or synchronize have not been called, invoking update on the same object throws the exception:
SUPPersistenceException: Attempt to update an object 
that was already changed by a non-default CUD operation.
Note: Calling updateUpdate on an orphaned instance (a row that no longer exists) causes a PersistenceException.
Customer cust = Customer.findById(101);
cust.setFname("supAdmin");
cust.setCompany_name("SAP");
cust.setPhone("777-8888");
cust.save(); // or cust.update();
cust.submitPending();
SMP101DB.synchronize(); 
// or SMP101DB.synchronize (String synchronizationGroup)

To update multiple MBOs in a relationship, call submitPending() on the parent MBO, or call submitPending() on the changed child MBO:

Customer cust = Customer.findById(101);
com.sybase.collections.ObjectList orders = cust.getSalesOrders();
SalesOrder order = (SalesOrder)orders.getByIndex(0);
order.setOrder_date(new Date(System.currentTimeMillis()));
order.save();
cust.submitPending();
Customer cust = Customer.FindByPrimaryKey(101);
cust.Fname = "supAdmin";
cust.Company_name = "SAP";
cust.Phone = "777-8888";
cust.Update();// or cust.Save();
cust.SubmitPending();

To update multiple MBOs in a relationship, if the relationship is a composite, call SubmitPending() on the parent MBO. If the relationship is not a composite, call SubmitPending() on each MBO within the relationship:

Customer cust = Customer.FindByPrimaryKey(101);
Sybase.Collections.GenericList<SalesOrder> orders = cust.Orders;
SalesOrder order = orders[0];
order.Order_date = DateTime.Now;
order.Save();
cust.SubmitPending();

In the following examples, the Customer and SalesOrder MBOs have a parent-child relationship.

Example 1: Supports update operations to parent entities. The sequence of calls is as follows:

SMP101Customer *customer = [ SMP101Customer find: 32] 
//find by the unique id
customer.city = @"Dublin"; //update any field to a new value
[customer update];
[customer submitPending];
[SMP101SMP101DB synchronize];

Example 2: Supports update operations to child entities. The sequence of calls is:

SMP101Sales_Order* order = [SMP101Sales_Order find: 1220];
order.region = @"SA"; //update any field
[order update]; //call update on the child record
[order refresh]; 
[order.customer submitPending]; //call submitPending on the parent
[SMP101SMP101DB synchronize];

Example 3: Calling save() on a parent also saves any modifications made to its children:

SMP101Customer *customer = [ SMP101Customer find: 32]
SUPObjectList* orderlist = customer.orders;
SMP101Sales_Order* order = [orderlist item:0];
order.sales_rep = @"Ram";
customer.state = @"MA" ;
[customer save];
[customer submitPending];
[SMP101SMP101DB synchronize];