public void updateJobRun(DateTime dt, CallableJob cj) throws BackendException {
Connection conn = null;
PreparedStatement stat = null;
try {
conn = newConnection();
stat =
conn.prepareStatement(
String.format("UPDATE %s SET dt = ?, callable_job = ?, name = ?, `code` = ?, status = ?, exception = ?,"
+ " start = ?, finish = ? WHERE id = ?", jobRunTableName));
int i = 1;
stat.setTimestamp(i++, new Timestamp(dt.getMillis()));
stat.setString(i++, objToString(cj));
stat.setString(i++, cj.getPlannedJob().getJobSpec().getName());
stat.setString(i++, cj.getPlannedJob().getJobSpec().getCode());
stat.setInt(i++, cj.getStatus().get());
stat.setString(i++, cj.getExceptionMessage() != null ? cj.getExceptionMessage().get() : "");
stat.setTimestamp(i++, new Timestamp(cj.getStart().get()));
stat.setTimestamp(i++, new Timestamp(cj.getFinish().get()));
stat.setLong(i++, cj.getJobId());
int rows = stat.executeUpdate();
LOG.info(String.format("Rows updated: %d", rows));
} catch (SQLException | IOException ex) {
throw new BackendException(ex);
} finally {
closeConnections(conn, stat);
}
}