Example:
// in the context of the ApplModuleImpl
// locate the employee's department
Number departmentId =
((EmployeesRowImpl)(this.getEmployees().getCurrentRow())).getDepartmentId();
Key keyDepartment = new Key(new Object[] { departmentId });
// get the department based on the department identifier
DepartmentsRowImpl department =
(DepartmentsRowImpl)this.getDepartments().getRow(keyDepartment);
if (department != null) {
// you can access the Department's attributes here....
}
Context:
Application Module Implementation Class
View Object Implementation Class
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:
ReplyDeletehttp://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#getRow_oracle_jbo_Key_
Nice post very informative
ReplyDelete