ColumnElement c = (ColumnElement) f.assocLocalColumns.get(0);
QueryTable t = addQueryTable(config.findTableDesc(c.getDeclaringTable()));
while (descIter.hasNext()) {
UpdateJoinTableDesc desc = (UpdateJoinTableDesc) descIter.next();
int action = getAction(desc.getAction());
UpdateStatement s = (UpdateStatement) createStatement(t);
s.setAction(action);
if (action == ACT_INSERT) {
insertStatements.add(s);
} else if (action == ACT_DELETE) {
// RESOLVE: There are redundant deletes from join tables that causes
// update to fail with no rows affected. To work around this problem
// for now, we set the minAffectedRows to 0.
// We need to figure out why there are redundant deletes.
s.minAffectedRows = 0;
deleteStatements.add(s);
}
s.addLocalConstraints(action, f, desc.getParentStateManager());
s.addForeignConstraints(action, f, desc.getForeignStateManager());
}
}
// All join table delete statements have to go first and all
// join table insert statements have to go last.