sb.append(pkColumn.getColumnName() + "=? AND ");
}
}
sb.delete(sb.lastIndexOf("AND"), sb.lastIndexOf("AND") + 3);
String sql = sb.toString();
DAO dao = DAO.getInstance();
dao.update(sql);
for (int i = 0; i < whereColumns.size(); i++) {
Column column = (Column)columns.get(i);
Cell cell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
dao.setObject(i+1, cell.getColumnValue());
}
dao.executeUpdate();
}
//Delete mainTables
StringBuffer sb = new StringBuffer("DELETE FROM ");
sb.append(mainTableName + " WHERE ");
Vector whereColumns = new Vector();
Iterator pkColumnIter = pkColumns.iterator();
while (pkColumnIter.hasNext()) {
Column pkColumn = (Column)pkColumnIter.next();
if (pkColumn.getTableName().equals(mainTableName)) {
whereColumns.add(pkColumn);
sb.append(pkColumn.getColumnName() + "=? AND ");
}
}
sb.delete(sb.lastIndexOf("AND"), sb.lastIndexOf("AND") + 3);
String sql = sb.toString();
dao.update(sql);
for (int i = 0; i < whereColumns.size(); i++) {
Column column = (Column)columns.get(i);
Cell cell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
dao.setObject(i+1, cell.getColumnValue());
}
dao.executeUpdate();
dao.commit();
dao.setAutoCommit(true);
return true;
}