private InsertCommandImpl getCreateCommand(DataObject changedObject) {
if ( createCommand == null ) {
Table table = mapping.getTableByPropertyName(changedObject.getType().getName());
if (table == null ) {
if (changedObject.getType().getProperty("ID") != null ) {
// If the table is not defined in the config, assume it has a primary key of "ID"
mapping.addPrimaryKey(changedObject.getType().getName() + ".ID");
table = mapping.getTableByPropertyName(changedObject.getType().getName());
} else {
throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config");
}
}
String createStatement = table.getCreate();
if ( createStatement == null ) {
createCommand = getCudGenerator().getInsertCommand(mapping, changedObject, table);
} else {
createCommand = new InsertCommandImpl(createStatement);
Iterator i = getCudGenerator().getCreateParameters(mapping, changedObject, table).iterator();