- cancelPending – cancels the previous create, update, or delete operations on the MBO. It cannot cancel submitted operations.
- submitPending – submits the operation so that it can be replayed on the Unwired Server. A request is sent to the Unwired Server during a synchronization.
- submitPendingOperations – submits all the pending records for the entity to the Unwired Server. This method internally invokes the submitPending method on each of the pending records.
- cancelPendingOperations – cancels all the pending records for the entity. This method internally invokes the cancelPending method on each of the pending records.
Note: Use the SubmitPendingOperations
and CancelPendingOperations methods only when there are
multiple pending entities on the same MBO type. Otherwise, use the MBO instance’s
SubmitPending or CancelPending methods,
which are more efficient if the MBO instance is already available in memory.
Customer customer = Customer.findById(101);
if (errorHappened) {
customer.cancelPending();
}
else {
customer.submitPending();
}
You can group multiple operations into a single transaction for improved performance:
// load the customer MBO with customer ID 100
Customer customer = Customer.findByPrimaryKey(100);
// Change phone number of that customer
customer.setPhone("8005551212");
// use one transaction to do save and submitPending
com.sybase.persistence.LocalTransaction tx = SUP101DB.beginTransaction();
try
{
customer.save();
customer.submitPending();
tx.commit();
}
catch (Exception e)
{
tx.rollback();
}