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

    // populate the object(s)
    for (int i = 0; i < records.size(); i++) {
      Record row = records.get(i);
      results.add(TDomainPeer.row2Object(row, 1, TDomainPeer.getOMClass()));
    }
    return results;
  }
Example #2
0
  /**
   * 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 TDomain row2Object(Record row, int offset, Class cls) throws TorqueException {
    try {
      TDomain obj = (TDomain) cls.newInstance();
      TDomainPeer.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);
    }
  }
Example #3
0
 /**
  * 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 {
   TDomainPeer.doDelete(criteria, (Connection) null);
 }