Package org.apache.empire.db

Examples of org.apache.empire.db.DBRecord.create()


    {
        DBRecord r = new DBRecord();
        Employee emp = empHolder.value;
        boolean init;
        if (emp.isNew())
            r.create(T_EMP, conn);
        else
            r.read(T_EMP, emp.getEmployeeId(), conn);

        r.setBeanValues(emp);
        r.update(conn);
View Full Code Here


    {
        DBRecord r = new DBRecord();
        Employee emp = new Employee();

        // null, so that no IDs are wasted.
        r.create(T_EMP, null);
        r.getBeanProperties(emp);

        emp.setNew(true);

        return emp;
View Full Code Here

        DBSQLScript script = new DBSQLScript();
        db.getCreateDDLScript(db.getDriver(), script);
        script.run(db.getDriver(), dbResource.getConnection(), false);
       
        DBRecord dep = new DBRecord();
        dep.create(db.DEPARTMENT);
        dep.setValue(db.DEPARTMENT.NAME, "junit");
        dep.setValue(db.DEPARTMENT.BUSINESS_UNIT, "test");
        dep.update(conn);
       
        Date date = dep.getDateTime(db.DEPARTMENT.UPDATE_TIMESTAMP);
View Full Code Here

        assertNotNull("Date is null", date);
        assertTrue("No departments", dep.getInt(db.DEPARTMENT.ID) > 0);
       
       
        DBRecord emp = new DBRecord();
        emp.create(db.EMPLOYEE);
        emp.setValue(db.EMPLOYEE.FIRSTNAME, "junit");
        emp.setValue(db.EMPLOYEE.LASTNAME, "test");
        emp.setValue(db.EMPLOYEE.GENDER, "m");
        emp.setValue(db.EMPLOYEE.DEPARTMENT_ID, dep.getInt(db.DEPARTMENT.ID));
        emp.update(conn);
View Full Code Here

     */
    private static int insertDepartment(Connection conn, String departmentName, String businessUnit)
    {
        // Insert a Department
        DBRecord rec = new DBRecord();
        rec.create(T_DEP);
        rec.setValue(T_DEP.C_NAME, departmentName);
        rec.setValue(T_DEP.C_BUSINESS_UNIT, businessUnit);
        if (!rec.update(conn))
        {
            log.error(rec.getErrorMessage());
View Full Code Here

     */
    private static int insertEmployee(Connection conn, String firstName, String lastName, String gender)
    {
        // Insert an Employee
        DBRecord rec = new DBRecord();
        rec.create(T_EMP);
        rec.setValue(T_EMP.C_FIRSTNAME, firstName);
        rec.setValue(T_EMP.C_LASTNAME, lastName);
        rec.setValue(T_EMP.C_GENDER, gender);
        if (!rec.update(conn))
        {
View Full Code Here

     */
    private static void insertEmpDepHistory(Connection conn, int employeeId, int departmentId, Date dateFrom)
    {
        // Insert an Employee
        DBRecord rec = new DBRecord();
        rec.create(T_EDH);
        rec.setValue(T_EDH.C_EMPLOYEE_ID, employeeId);
        rec.setValue(T_EDH.C_DEPARTMENT_ID, departmentId);
        rec.setValue(T_EDH.C_DATE_FROM, dateFrom);
        if (!rec.update(conn))
        {
View Full Code Here

    // 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);
View Full Code Here

   * 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;
View Full Code Here

   * 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);
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.