This commit is contained in:
Ziver Koc 2016-08-29 19:08:15 +02:00
parent 30530c0648
commit 69544b4552

View file

@ -24,14 +24,17 @@ public class DeviceDataSqlResult implements SQLResultHandler<HalDeviceData> {
@Override
public HalDeviceData handleQueryResult(Statement stmt, ResultSet result) throws SQLException {
try {
HalDeviceData dataObj = clazz.newInstance();
dataObj.setData(result.getDouble("data"));
dataObj.setTimestamp(result.getLong("timestamp"));
return dataObj;
if (result.next()) {
HalDeviceData dataObj = clazz.newInstance();
dataObj.setData(result.getDouble("data"));
dataObj.setTimestamp(result.getLong("timestamp"));
return dataObj;
}
} catch (SQLException e){
throw e;
} catch (Exception e){
throw new SQLException(e);
}
return null;
}
}