code: private long getMostRecentZerothPartitionSubJobInstanceId(long rootJobInstanceId, String stepName) {
  		 
  		StringBuilder sb = new StringBuilder(":");
  		sb.append(Long.toString(rootJobInstanceId));
  		sb.append(":");
  		sb.append(stepName);
  		sb.append(":0");
  
  		String zerothPartitionSubJobName = sb.toString();
  		
  		Connection conn = null;
  		PreparedStatement statement = null;
  		ResultSet rs = null;
  		long instanceId = 0;
  		
  		try {
  			conn = getConnection();
  			statement = conn.prepareStatement("select max(jobinstanceid) as mostrecentid from jobinstancedata where name = ?");
  			statement.setObject(1, zerothPartitionSubJobName);
  			rs = statement.executeQuery();
  			if (rs.next()) {
  				instanceId = rs.getLong("mostrecentid");
  			} else {
  				String msg = "Did not find sub job instance named = " + zerothPartitionSubJobName;
  				logger.fine(msg);
  				throw new NoSuchJobInstanceException(msg);
  			}
  		} catch (SQLException e) {
  			throw new PersistenceException(e);
  		} finally {
  			cleanupConnection(conn, rs, statement);
  		}
  
  		return instanceId;
  	}
docs: /*
  Because of how we implement partition restart after override as well as partitions after a restart
  after completion (we simply create a new "subjob" job instance id entry), we have to have a way
  to only look at the most recent one.
  
  There may be gaps in doing it this way, e.g. what if the previous execution blew up before persisting
  a complete set (one for each partition)?   Will leave that for another time if necessary.