Package org.apache.empire.db

Examples of org.apache.empire.db.DBCommand.orderBy()


    cmd.select(DEP.NAME.as("DEPARTMENT"));
    cmd.select(DEP.BUSINESS_UNIT);
    cmd.join(EMP.DEPARTMENT_ID, DEP.DEPARTMENT_ID);
        // Set constraints and order
        cmd.where(EMP.LASTNAME.length().isGreaterThan(0));
        cmd.orderBy(EMP.LASTNAME, EMP.FIRSTNAME);

        /*
        // Example for limitRows() and skipRows()
        if (db.getDriver().isSupported(DBDriverFeature.QUERY_LIMIT_ROWS))
        {  // set maximum number of rows
View Full Code Here


        cmd.select(DEP.NAME.as("DEPARTMENT"));
        cmd.select(DEP.BUSINESS_UNIT);
        cmd.join(EMP.DEPARTMENT_ID, DEP.DEPARTMENT_ID);
        // Set constraints and order
        cmd.where(EMP.LASTNAME.length().isGreaterThan(0));
        cmd.orderBy(EMP.LASTNAME, EMP.FIRSTNAME);

        /*
        // Example for limitRows() and skipRows()
        if (db.getDriver().isSupported(DBDriverFeature.QUERY_LIMIT_ROWS))
        {  // set maximum number of rows
View Full Code Here

        queryCmd.select(EMP.GENDER, EMP.DATE_OF_BIRTH, EMP.RETIRED);
        // queryCmd.select(EMP.RETIRED.decode(true, "X", "-"));
        queryCmd.select(DEPARTMENT);

        queryCmd.join(DEP.DEPARTMENT_ID, EMP.DEPARTMENT_ID);
        queryCmd.orderBy(EMP.FIRST_NAME);
       
        addAllConstraints(queryCmd);

        employees.initItems(queryCmd);
    }
View Full Code Here

        {
            SampleDB db = (SampleDB) getDatabase();
            DBCommand cmd = db.createCommand();
            cmd.select(db.T_DEPARTMENTS.DEPARTMENT_ID);
            cmd.select(db.T_DEPARTMENTS.NAME);
            cmd.orderBy(db.T_DEPARTMENTS.NAME);
            return db.queryOptionList(cmd, SampleUtils.getConnection());
        }
        // base class implementation
        return super.getFieldOptions(column);
    }
View Full Code Here

        {
            SampleDB db = getDatabase();
            DBCommand cmd = db.createCommand();
            cmd.select(db.T_DEPARTMENTS.C_DEPARTMENT_ID);
            cmd.select(db.T_DEPARTMENTS.C_NAME);
            cmd.orderBy(db.T_DEPARTMENTS.C_NAME.asc());
            departments = db.queryOptionList(cmd, getConnection());
        }
        return departments;
    }
   
View Full Code Here

            cmd.where(EMP.C_FIRSTNAME.likeUpper( si.getFirstName()+"%" )
                  .or(EMP.C_FIRSTNAME.is(null)));
        if (StringUtils.isNotEmpty( si.getLastName()) )
            cmd.where(EMP.C_LASTNAME.likeUpper( si.getLastName()+"%" ));
       
        cmd.orderBy(EMP.C_LASTNAME);
        cmd.orderBy(EMP.C_FIRSTNAME);
       
        // Init BeanList
        if (!employeeBeanList.initBeanList(cmd))
        {   // Error
View Full Code Here

                  .or(EMP.C_FIRSTNAME.is(null)));
        if (StringUtils.isNotEmpty( si.getLastName()) )
            cmd.where(EMP.C_LASTNAME.likeUpper( si.getLastName()+"%" ));
       
        cmd.orderBy(EMP.C_LASTNAME);
        cmd.orderBy(EMP.C_FIRSTNAME);
       
        // Init BeanList
        if (!employeeBeanList.initBeanList(cmd))
        {   // Error
            return LIST;
View Full Code Here

            // STEP 7: read from Employee_Info_View
            System.out.println("--------------------------------------------------------");
            System.out.println("*** read from EMPLOYEE_INFO_VIEW ***");
            DBCommand cmd = db.createCommand();
            cmd.select (db.V_EMPLOYEE_INFO.getColumns());
            cmd.orderBy(db.V_EMPLOYEE_INFO.C_NAME_AND_DEP);
            printQueryResults(cmd, conn);

            // STEP 8: prepared Statement sample
            System.out.println("--------------------------------------------------------");
            System.out.println("*** commandParamsSample: shows how to use command parameters for the generation of prepared statements ***");
 
View Full Code Here

        cmd.join(T_EMP.C_EMPLOYEE_ID, T_EDH.C_EMPLOYEE_ID);
        cmd.join(T_DEP.C_DEPARTMENT_ID, T_EDH.C_DEPARTMENT_ID);
        // Set Constraints
        cmd.where(T_EMP.C_RETIRED.is(false));
        // Set Order
        cmd.orderBy(T_EMP.C_LASTNAME);
        cmd.orderBy(T_EMP.C_FIRSTNAME);

        // Query Records and print output
        printQueryResults(cmd, conn);
       
View Full Code Here

        cmd.join(T_DEP.C_DEPARTMENT_ID, T_EDH.C_DEPARTMENT_ID);
        // Set Constraints
        cmd.where(T_EMP.C_RETIRED.is(false));
        // Set Order
        cmd.orderBy(T_EMP.C_LASTNAME);
        cmd.orderBy(T_EMP.C_FIRSTNAME);

        // Query Records and print output
        printQueryResults(cmd, conn);
       
        // Define an updateable query
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.