private Integer[] requiredTables(CollectionSchema colSchema, Projection projection) {
    Collection<SubDocTable> subDocTables = colSchema.getSubDocTables();

    Integer[] result = new Integer[subDocTables.size()];
    int i = 0;
    for (SubDocTable subDocTable : subDocTables) {
      result[i] = subDocTable.getTypeId();
      i++;
    }
    return result;
  }
  @Override
  public void setFindDocsSelectStatementParameters(
      CollectionSchema colSchema,
      Integer[] requestedDocs,
      Projection projection,
      Connection c,
      PreparedStatement ps)
      throws SQLException {
    ps.setString(1, colSchema.getName());

    ps.setArray(2, c.createArrayOf("integer", requestedDocs));

    Integer[] requiredTables = requiredTables(colSchema, projection);
    ps.setArray(3, c.createArrayOf("integer", requiredTables));
  }