"SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml"));
select.setConnection(getConnection());
select.setConnection(getConnection());
select.setParameterValue("ID", new Integer(1));
DataObject graph1 = select.executeQuery();
DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0);
assertEquals(2, customer.getList("orders").size());
select.setParameterValue("ID", new Integer(2));
DataObject graph2 = select.executeQuery();
DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0);
assertEquals(1, graph2.getList("CUSTOMER").size());
assertEquals(1, customer2.getList("orders").size());
assertEquals(2, customer2.getInt("ID"));
GraphMerger merger = new GraphMerger();
merger.addPrimaryKey("CUSTOMER.ID");
merger.addPrimaryKey("ANORDER.ID");
DataObject mergedGraph = merger.merge(graph1, graph2);
assertEquals(3, mergedGraph.getList("ANORDER").size());
assertEquals(2, mergedGraph.getList("CUSTOMER").size());
DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1);
assertEquals(2, mergedCustomer.getInt("ID"));
assertEquals(1, mergedCustomer.getList("orders").size());
DataObject mergedOrder = (DataObject) mergedCustomer.getList("orders").get(0);
assertEquals(4, mergedOrder.getInt("ID"));
}