Sunday, May 2, 2010

Bit #15 - Using a Key to locate a Row in a View Object, Pt. 2

Instead of using the findByKey() method to locate a number of rows in the View Object identified by a Key attribute - explained in Bit #14 - Using a Key to locate a Row in a View Object, you can use the View Object getRow() method supplying the Key as an argument. This method will return the Row identified by the Key supplied as an argument to it. An example follows.


    // in the context of the ApplModuleImpl

    // locate the employee's department
    Number departmentId =
    Key keyDepartment = new Key(new Object[] { departmentId });

    // get the department based on the department identifier
    DepartmentsRowImpl department =

    if (department != null) {
        // you can access the Department's attributes here....


Application Module Implementation Class
View Object Implementation Class


  1. Although it's more comfortable to use the getRow method instead of the findByKey one because of the array stuff, I think it worths pointing out that findByKey is better in performance than getRow. You can read it here:


Related Posts Plugin for WordPress, Blogger...