use of org.cerberus.database.DatabaseSpring in project cerberus-source by cerberustesting.
the class RobotDAO method readByKey.
@Override
public Robot readByKey(String robot) throws CerberusException {
Robot result;
final String query = "SELECT * FROM `robot` WHERE `robot` = ?";
// Debug message on SQL.
if (LOG.isDebugEnabled()) {
LOG.debug("SQL : " + query);
}
try {
result = RequestDbUtils.executeQuery(databaseSpring, query, ps -> {
ps.setString(1, robot);
}, rs -> {
return loadFromResultSet(rs);
});
} catch (SQLException exception) {
LOG.error("Unable to execute query : " + exception.toString());
throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR), exception);
}
// sets the message
return result;
}
Aggregations