}
private InsertCommandImpl getCreateCommand(DataObject changedObject) {
if (createCommand == null) {
Table table = mapping.getTableByTypeName(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.getTableByTypeName(changedObject.getType().getName());
} else {
throw new RuntimeException("Table " + changedObject.getType().getName()
+ " was changed in the DataGraph but is not present in the Config");
}
}
Create create = table.getCreate();
if (create == null) {
createCommand = InsertGenerator.INSTANCE.getInsertCommand(mapping, changedObject, table);
} else {
createCommand = new InsertCommandImpl(create);