/**
   * Method to do updates. This method is to be used during a transaction, otherwise use the
   * doUpdate(Criteria) method. It will take care of the connection details internally.
   *
   * @param criteria object containing data that is used to create the UPDATE statement.
   * @param con the connection to use
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  public static void doUpdate(Criteria criteria, Connection con) throws TorqueException {
    Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
    selectCriteria.put(ID, criteria.remove(ID));

    setDbName(criteria);

    if (con == null) {
      BasePeer.doUpdate(selectCriteria, criteria);
    } else {
      BasePeer.doUpdate(selectCriteria, criteria, con);
    }
  }
Beispiel #2
0
  /**
   * Method to do updates. This method is to be used during a transaction, otherwise use the
   * doUpdate(Criteria) method. It will take care of the connection details internally.
   *
   * @param criteria object containing data that is used to create the UPDATE statement.
   * @param con the connection to use
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  public static void doUpdate(Criteria criteria, Connection con) throws TorqueException {
    Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
    selectCriteria.put(EXAM_ID, criteria.remove(EXAM_ID));

    // Set the correct dbName if it has not been overridden
    // criteria.getDbName will return the same object if not set to
    // another value so == check is okay and faster
    if (criteria.getDbName() == Torque.getDefaultDB()) {
      criteria.setDbName(DATABASE_NAME);
    }
    if (con == null) {
      BasePeer.doUpdate(selectCriteria, criteria);
    } else {
      BasePeer.doUpdate(selectCriteria, criteria, con);
    }
  }