/**
* Dilton's bug for adding new child data object
*/
public void testAddNewOrder() throws Exception {
DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
// Read some customers and related orders
Command select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER "
+ "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID");
DataObject root = select.executeQuery();
DataObject cust = root.getDataObject("CUSTOMER[1]");
// Save ID and Order Count
int custID = cust.getInt("ID");
int custOrderCount = cust.getList("orders").size();
// Create a new Order and add to customer1
DataObject order = root.createDataObject("ANORDER");
order.set("ID", Integer.valueOf(99));
order.set("PRODUCT", "The 99th product");
order.set("QUANTITY", Integer.valueOf(99));
cust.getList("orders").add(order);
assertEquals(custOrderCount + 1, cust.getList("orders").size());
// Build apply changes command
das.applyChanges(root);
// verify cust1 relationship updates
select = das.createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER "
+ "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?");
select.setParameter(1, Integer.valueOf(custID));
root = select.executeQuery();