/**
   * selects a collection of OrdenTrabajo objects pre-filled with their Trabajador objects.
   *
   * <p>This method is protected by default in order to keep the public api reasonable. You can
   * provide public methods for those you actually need in OrdenTrabajoPeer.
   *
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  protected static List doSelectJoinTrabajador(Criteria criteria) throws TorqueException {
    setDbName(criteria);

    OrdenTrabajoPeer.addSelectColumns(criteria);
    int offset = numColumns + 1;
    TrabajadorPeer.addSelectColumns(criteria);

    criteria.addJoin(OrdenTrabajoPeer.RESPONSABLE_ID, TrabajadorPeer.ID);

    List rows = BasePeer.doSelect(criteria);
    List results = new ArrayList();

    for (int i = 0; i < rows.size(); i++) {
      Record row = (Record) rows.get(i);

      Class omClass = OrdenTrabajoPeer.getOMClass();
      OrdenTrabajo obj1 = (OrdenTrabajo) OrdenTrabajoPeer.row2Object(row, 1, omClass);
      omClass = TrabajadorPeer.getOMClass();
      Trabajador obj2 = (Trabajador) TrabajadorPeer.row2Object(row, offset, omClass);

      boolean newObject = true;
      for (int j = 0; j < results.size(); j++) {
        OrdenTrabajo temp_obj1 = (OrdenTrabajo) results.get(j);
        Trabajador temp_obj2 = (Trabajador) temp_obj1.getTrabajador();
        if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) {
          newObject = false;
          break;
        }
      }
      results.add(obj1);
    }
    return results;
  }
  /**
   * The returned List will contain objects of the default type or objects that inherit from the
   * default.
   *
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  public static List populateObjects(List records) throws TorqueException {
    List results = new ArrayList(records.size());

    // populate the object(s)
    for (int i = 0; i < records.size(); i++) {
      Record row = (Record) records.get(i);
      results.add(OrdenTrabajoPeer.row2Object(row, 1, OrdenTrabajoPeer.getOMClass()));
    }
    return results;
  }