The create operation allows the client to create a new record in the local database. To execute a create operation on an MBO, create a new MBO instance, and set the MBO attributes, then call the save() or create() operation. To propagate the changes to the server, call submitPending.
Example 1: Supports create operations on parent entities. The sequence of calls is:
SUP101Customer *newcustomer = [[SUP101Customer alloc] init]; newcustomer.fname = @”John”; ... //Set the required fields for the customer [newcustomer create]; [newcustomer submitPending]; [SUP101SUP101DB synchronize];
Example 2: Supports create operations on child entities.
SUP101Sales_Order *order = [[SUP101Sales_Order alloc] init]; [order autorelease]; //Set the other required fields for the order order.region = @"Eastern"; order.xxx = yyy; SUP101Customer *customer = [SUP101Customer find:1008]; [order setCustomer:customer]; [order create]; [order.customer refresh]; //refresh the parent [order.customer submitPending]; //call submitPending on the parent. [SUP101SUP101DB synchronize];