Save Operation

The save operation saves a record to the local database. In the case of an existing record, a save operation calls the update operation. If a record does not exist, the save operation creates a new record.

//Update an existing customer
Customer cust = Customer.findById(101);
cust.save();

//Insert a new customer
Customer cust = new Customer();
cust.save();