Examples of DBRecord


Examples of org.apache.empire.db.DBRecord

   
    // STEP 5: Clear Database (Delete all records)
    System.out.println("*** Step 5: clearDatabase() ***");
    clearDatabase(conn, db);

    DBRecord dep = new DBRecord();
    dep.create(db.DEPARTMENT);
    dep.setValue(db.DEPARTMENT.NAME, "junit");
    dep.setValue(db.DEPARTMENT.BUSINESS_UNIT, "中文");
    dep.update(conn);

    int id = dep.getInt(db.DEPARTMENT.ID);

    // Update an Employee
    DBRecord depRead = new DBRecord();
    depRead.read(db.DEPARTMENT, id, conn);

    // You may see ?? in the DB record
    assertEquals("中文", depRead.getString(db.DEPARTMENT.BUSINESS_UNIT));
  }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

        removeFromSession();
    }
   
    public DBRecord detachRecord()
    {
        DBRecord rec = record;
        record = null;
        return rec;
    }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

    // ------- Action Construction -------
   
    public EmployeeDetailAction() {
        // Init Record Support Object
        DBTable table = getDatabase().T_EMPLOYEES;
        DBRecord record = new EmployeeRecord(this);
        // create a support Object
        recordSupport = new RecordActionSupport(this, table, record, SessionPersistence.Key);
    }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

  /*
   * Insert a department
   */
  private int insertDepartmentSampleRecord(Connection conn, String department_name, String businessUnit) {
      // Insert a Department
      DBRecord rec = new DBRecord();
      rec.create(db.T_DEPARTMENTS);
      rec.setValue(db.T_DEPARTMENTS.C_NAME, department_name);
      rec.setValue(db.T_DEPARTMENTS.C_BUSINESS_UNIT, businessUnit);
      if (!rec.update(conn)) {
        log.error(rec.getErrorMessage());
        return 0;
      }
      // Return Department ID
      return rec.getInt(db.T_DEPARTMENTS.C_DEPARTMENT_ID);
    }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

  /*
   * Insert a person
   */
  private int insertEmployeeSampleRecord(Connection conn, String salutation, String firstName, String lastName, String gender, int depID) {
    // Insert an Employee
    DBRecord rec = new DBRecord();
    rec.create(db.T_EMPLOYEES);
    rec.setValue(db.T_EMPLOYEES.C_SALUTATION, salutation);
    rec.setValue(db.T_EMPLOYEES.C_FIRSTNAME, firstName);
    rec.setValue(db.T_EMPLOYEES.C_LASTNAME, lastName);
    rec.setValue(db.T_EMPLOYEES.C_GENDER, gender);
    rec.setValue(db.T_EMPLOYEES.C_DEPARTMENT_ID, depID);
    if (!rec.update(conn)) {
      log.error(rec.getErrorMessage());
      return 0;
    }
    // Return Employee ID
    return rec.getInt(db.T_EMPLOYEES.C_EMPLOYEE_ID);
  }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

     * </PRE>
   */
  private static int insertDepartment(Connection conn, String departmentName, String businessUnit)
    {
    // Insert a Department
    DBRecord rec = new DBRecord();
    rec.create(db.DEPARTMENTS);
    rec.setValue(db.DEPARTMENTS.NAME, departmentName);
    rec.setValue(db.DEPARTMENTS.BUSINESS_UNIT, businessUnit);
    rec.update(conn);
    // Return Department ID
    return rec.getInt(db.DEPARTMENTS.DEPARTMENT_ID);
  }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

     * </PRE>
   */
  private static int insertEmployee(Connection conn, String firstName, String lastName, String gender, int departmentId)
    {
    // Insert an Employee
    DBRecord rec = new DBRecord();
    rec.create(db.EMPLOYEES);
    rec.setValue(db.EMPLOYEES.FIRSTNAME, firstName);
    rec.setValue(db.EMPLOYEES.LASTNAME, lastName);
    rec.setValue(db.EMPLOYEES.GENDER, gender);
    rec.setValue(db.EMPLOYEES.DEPARTMENT_ID, departmentId);
    rec.update(conn);
    // Return Employee ID
    return rec.getInt(db.EMPLOYEES.EMPLOYEE_ID);
  }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

     * </PRE>
   */
  private static void updateEmployee(Connection conn, int idPers, String phoneNumber)
    {
    // Update an Employee
    DBRecord rec = new DBRecord();
    rec.read(db.EMPLOYEES, idPers, conn);
    // Set
    rec.setValue(db.EMPLOYEES.PHONE_NUMBER, phoneNumber);
    rec.update(conn);
  }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

  /*
   * Insert a department
   */
  private int insertDepartmentSampleRecord(Connection conn, String department_name, String businessUnit) {
      // Insert a Department
      DBRecord rec = new DBRecord();
      rec.create(db.T_DEPARTMENTS);
      rec.setValue(db.T_DEPARTMENTS.C_NAME, department_name);
      rec.setValue(db.T_DEPARTMENTS.C_BUSINESS_UNIT, businessUnit);
      if (!rec.update(conn)) {
        log.error(rec.getErrorMessage());
        return 0;
      }
      // Return Department ID
      return rec.getInt(db.T_DEPARTMENTS.C_DEPARTMENT_ID);
    }
View Full Code Here

Examples of org.apache.empire.db.DBRecord

  /*
   * Insert a person
   */
  private int insertEmployeeSampleRecord(Connection conn, String salutation, String firstName, String lastName, String gender, int depID) {
    // Insert an Employee
    DBRecord rec = new DBRecord();
    rec.create(db.T_EMPLOYEES);
    rec.setValue(db.T_EMPLOYEES.C_SALUTATION, salutation);
    rec.setValue(db.T_EMPLOYEES.C_FIRSTNAME, firstName);
    rec.setValue(db.T_EMPLOYEES.C_LASTNAME, lastName);
    rec.setValue(db.T_EMPLOYEES.C_GENDER, gender);
    rec.setValue(db.T_EMPLOYEES.C_DEPARTMENT_ID, depID);
    if (!rec.update(conn)) {
      log.error(rec.getErrorMessage());
      return 0;
    }
    // Return Employee ID
    return rec.getInt(db.T_EMPLOYEES.C_EMPLOYEE_ID);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.