requestFields = getFieldsToQuery(requestFields);
ResultSet resultSet = null;
PreparedStatement statement = null;
try {
Where where = new Where();
SelectStatement select = new SelectStatement(mapping.getTableName());
select.setWhere(where);
// boolean isPrimarySelected = false;
// for (int i = 0; i < requestFields.length; i++) {
// if(primaryColumn.getName().equals(primaryColumn)) {
// isPrimarySelected = true;
// break;
// }
// }
// if(!isPrimarySelected) {
// requestFields = StringUtils.append(requestFields, primaryColumn.getName());
// }
for (int i = 0; i < requestFields.length; i++) {
Column column = mapping.getColumn(requestFields[i]);
select.addToSelectList(column.getName());
}
where.equals(primaryColumn.getName(), "?");
statement = getConnection().prepareStatement(select.toString());
setObject(statement, 1, key, keySqlType, primaryColumn);
resultSet = statement.executeQuery();