/**
   * 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<TRoleListType> populateObjects(List<Record> records) throws TorqueException {
    List<TRoleListType> results = new ArrayList<TRoleListType>(records.size());

    // populate the object(s)
    for (int i = 0; i < records.size(); i++) {
      Record row = records.get(i);
      results.add(TRoleListTypePeer.row2Object(row, 1, TRoleListTypePeer.getOMClass()));
    }
    return results;
  }
  /**
   * selects a collection of TRoleListType objects pre-filled with their TListType 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 TRoleListTypePeer.
   *
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  protected static List<TRoleListType> doSelectJoinTListType(Criteria criteria, Connection conn)
      throws TorqueException {
    setDbName(criteria);

    TRoleListTypePeer.addSelectColumns(criteria);
    int offset = numColumns + 1;
    TListTypePeer.addSelectColumns(criteria);

    criteria.addJoin(TRoleListTypePeer.LISTTYPE, TListTypePeer.PKEY);

    correctBooleans(criteria);

    List<Record> rows;
    if (conn == null) {
      rows = BasePeer.doSelect(criteria);
    } else {
      rows = BasePeer.doSelect(criteria, conn);
    }

    List<TRoleListType> results = new ArrayList<TRoleListType>();

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

      Class omClass = TRoleListTypePeer.getOMClass();
      TRoleListType obj1 = (TRoleListType) TRoleListTypePeer.row2Object(row, 1, omClass);
      omClass = TListTypePeer.getOMClass();
      TListType obj2 = (TListType) TListTypePeer.row2Object(row, offset, omClass);

      boolean newObject = true;
      for (int j = 0; j < results.size(); j++) {
        TRoleListType temp_obj1 = results.get(j);
        TListType temp_obj2 = (TListType) temp_obj1.getTListType();
        if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) {
          newObject = false;
          temp_obj2.addTRoleListType(obj1);
          break;
        }
      }
      if (newObject) {
        obj2.initTRoleListTypes();
        obj2.addTRoleListType(obj1);
      }
      results.add(obj1);
    }
    return results;
  }
  /**
   * Create a new object of type cls from a resultset row starting from a specified offset. This is
   * done so that you can select other rows than just those needed for this object. You may for
   * example want to create two objects from the same row.
   *
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  public static TRoleListType row2Object(Record row, int offset, Class cls) throws TorqueException {
    try {
      TRoleListType obj = (TRoleListType) cls.newInstance();
      TRoleListTypePeer.populateObject(row, offset, obj);
      obj.setModified(false);
      obj.setNew(false);

      return obj;
    } catch (InstantiationException e) {
      throw new TorqueException(e);
    } catch (IllegalAccessException e) {
      throw new TorqueException(e);
    }
  }
 /**
  * Method to do deletes.
  *
  * @param criteria object containing data that is used DELETE from database.
  * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
  *     TorqueException.
  */
 public static void doDelete(Criteria criteria) throws TorqueException {
   TRoleListTypePeer.doDelete(criteria, (Connection) null);
 }