/**
   * selects a collection of OrdenTrabajo objects pre-filled with their Reparacion 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 doSelectJoinReparacion(Criteria criteria) throws TorqueException {
    setDbName(criteria);

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

    criteria.addJoin(OrdenTrabajoPeer.REPARACION_ID, ReparacionPeer.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 = ReparacionPeer.getOMClass();
      Reparacion obj2 = (Reparacion) ReparacionPeer.row2Object(row, offset, omClass);

      boolean newObject = true;
      for (int j = 0; j < results.size(); j++) {
        OrdenTrabajo temp_obj1 = (OrdenTrabajo) results.get(j);
        Reparacion temp_obj2 = (Reparacion) temp_obj1.getReparacion();
        if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) {
          newObject = false;
          break;
        }
      }
      results.add(obj1);
    }
    return results;
  }
예제 #2
0
 /**
  * Declares an association between this object and a Reparacion object
  *
  * @param v Reparacion
  * @throws TorqueException
  */
 public void setReparacion(Reparacion v) throws TorqueException {
   if (v == null) {
     setReparacionId(0);
   } else {
     setReparacionId(v.getId());
   }
   aReparacion = v;
 }