use of com.ibm.jbatch.container.exception.PersistenceException in project Payara by payara.
the class JBatchJDBCPersistenceManager method getJobInstanceIdByExecutionId.
public long getJobInstanceIdByExecutionId(long executionId) throws NoSuchJobExecutionException {
long instanceId = 0;
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(JOB_INSTANCE_ID_BY_EXECUTION_ID));
statement.setObject(1, executionId);
rs = statement.executeQuery();
if (rs.next()) {
instanceId = rs.getLong("jobinstanceid");
} else {
String msg = "Did not find job instance associated with executionID =" + executionId;
logger.fine(msg);
throw new NoSuchJobExecutionException(msg);
}
} catch (SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
return instanceId;
}
Aggregations