PreparedStatement queryStatement = null;
ResultSet results = null;
if (id == 0) {
return new ServerGroup(0, "Default", profileId);
}
try (Connection sqlConnection = sqlService.getConnection()) {
queryStatement = sqlConnection.prepareStatement(
"SELECT * FROM " + Constants.DB_TABLE_SERVER_GROUPS +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
queryStatement.setInt(1, id);
results = queryStatement.executeQuery();
if (results.next()) {
ServerGroup curGroup = new ServerGroup(results.getInt(Constants.GENERIC_ID),
results.getString(Constants.GENERIC_NAME),
results.getInt(Constants.GENERIC_PROFILE_ID));
return curGroup;
}
logger.info("Did not find the ID: {}", id);