コード例 #1
0
  /*
   * If your result set concurrency is ResultSet.CONCUR_UPDATABLE,
   * you can update rows in the result on the fly.
   */
  static void updateRow(Database db) throws DatabaseException {
    // The following two method calls depend on the database being used, they may be optional
    db.setResultSetConcurrency(ResultSet.CONCUR_UPDATABLE);
    db.setResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
    Result<Customer> result = db.queryObject(Customer.class, "where customer_id = ?", "ssmith");

    for (Customer c : result) {
      result.setColumnValue("company_name", "ACBProducts");
      result.updateRow();
    }
  }