abortTransaction Instruction

The abortTransaction instruction aborts the current transaction.

Syntax

The syntax of the abortTransaction instruction is:

abortTransaction;

Description

The abortTransaction instruction requests the JADE Object Manager to undo any changes made to persistent objects since the previous beginTransaction. It also causes locks to be released for objects that were updated within the transaction.

If you use this instruction when not in transaction state, all transaction duration locks on persistent objects will be released.

For details about reading and writing transactions, see "Using Read and Write Transactions", earlier in this chapter.

Example

The following example shows the use of the abortTransaction instruction.

bAdd_click(button: Button input) updating;
vars
    err : String;
begin
    beginTransaction;
    create customer;
    err := customer.loadSelf(company,
                             customerName.text,
                             address.text,
                             contact.text);
    if err <> "" then
        abortTransaction;             // Never put message boxes up
        app.msgBox(err, "Error", 0);  // while in transaction state.
        customer := null;
        return;
    endif;
    commitTransaction;
    unloadForm;
end;