Java Reference
In-Depth Information
F
Updates
PendingOrder's line items
private void updateQuantities() {
doWithTransaction(new TxnCallback() {
public void execute() throws Exception {
PendingOrder po = loadPendingOrder();
po.updateQuantities(new int[] { 1, 2 });
}
});
}
G
Changes
PendingOrder's line items
private void changeQuantities() {
doWithTransaction(new TxnCallback() {
public void execute() throws Exception {
PendingOrder po = loadPendingOrder();
po.updateQuantities(new int[] { 0, 2 });
}
});
}
H
Deletes
PendingOrder
private void deletePendingOrder() {
doWithTransaction(new TxnCallback() {
public void execute() throws Exception {
PendingOrder po = loadPendingOrder();
deletePersistent(po);
}
});
}
}
The
testPendingOrder()
method calls several helper methods that implement
the steps of the test. Let's look at the details:
The
createPendingOrder()
method creates a
PendingOrder
and persists it.
The
createRestaurant()
method creates and saves a
Restaurant
, which is
used by the test.
B
C
D
The
updateDeliveryInformation()
method loads
PendingOrder
and calls
PendingOrder.updateDeliveryInfo()
.
The
updateRestaurant()
method loads
PendingOrder
and the
Restaurant
that was created earlier and calls
PendingOrder.updateRestaurant()
, which
creates an association from the
PendingOrder
to the
Restaurant
.
The
updateQuantities()
method calls
PendingOrder.updateQuantities()
,
which creates line items.
E
F
Search WWH ::
Custom Search