preparedStatement.setString(1, jobName);
}
final ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
final long i = rs.getLong(TableColumn.JOBINSTANCEID);
JobInstanceImpl jobInstance1 = (JobInstanceImpl) jobInstances.get(i);
if (jobInstance1 == null) {
final String appName = rs.getString(TableColumn.APPLICATIONNAME);
if (jobName == null) {
final String goodJobName = rs.getString(TableColumn.JOBNAME);
jobInstance1 = new JobInstanceImpl(getJob(goodJobName), new ApplicationAndJobName(appName, goodJobName));
} else {
jobInstance1 = new JobInstanceImpl(getJob(jobName), new ApplicationAndJobName(appName, jobName));
}
jobInstance1.setId(i);
jobInstances.put(i, jobInstance1);
}
//this job instance is already in the cache, so get it from the cache
result.add(jobInstance1);
}