// UPDATE SQL
updateSql = "update " + tableName + " set ";
int setFields = 0;
for (int i = 0; i < tableFields.length; ++i) {
JDBCCMPFieldBridge2 field = tableFields[i];
if (!field.isPrimaryKeyMember()) {
if (setFields++ > 0) {
updateSql += ", ";
}
updateSql += field.getColumnName() + "=?";
}
}
updateSql += " where ";
updateSql += pkFields[0].getColumnName() + "=?";
for (int i = 1; i < pkFields.length; ++i) {
updateSql += " and " + pkFields[i].getColumnName() + "=?";
}
if (entity.getVersionField() != null) {
updateSql += " and " + entity.getVersionField().getColumnName() + "=?";
}
log.debug("update sql: " + updateSql);
// SELECT SQL
String selectColumns = tableFields[0].getColumnName();
for (int i = 1; i < tableFields.length; ++i) {
JDBCCMPFieldBridge2 field = tableFields[i];
selectColumns += ", " + field.getColumnName();
}
String whereColumns = pkFields[0].getColumnName() + "=?";
for (int i = 1; i < pkFields.length; ++i) {
whereColumns += " and " + pkFields[i].getColumnName() + "=?";