HelperContext hc = HelperProvider.getDefaultContext();
CustomerFactory.INSTANCE.register(hc);
Type customerType = hc.getTypeHelper().getType(Customer.class);
DataGraph dataGraph = SDOUtil.createDataGraph();
Customer customer = (Customer) dataGraph.createRootObject(customerType);
Account account = CustomerFactory.INSTANCE.createAccount();
customer.setAccount(account);
customer.setFirstName("John");
customer.getAccount().setAccountNum(1234);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
SDOUtil.saveDataGraph(dataGraph, outputStream, null);
DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
loadDataGraph.getChangeSummary().beginLogging();
customer = (Customer) loadDataGraph.getRootObject();
customer.getAccount().setAccountNum(987);
loadDataGraph.getChangeSummary().endLogging();
List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
}