Advanced programmatic view object in 12.2.1.x

JDev version:
Source: GitHub

The previous versions of ADF required a lot of knowledge of framework methods, while attempting to create programmatic view objects based on non-SQL data sources, such as a PL/SQL ref cursor.

This blog shows you how to create a search form, which passes a department id to a packaged procedure, and display results based on a ref cursor returned by the procedure.

Create a simple procedure, which returns some employee data, based on a department_id entered by user.

Create a view object - EmployeesVO, and select Programmatic while selecting Data Source. Create the necessary view object implementation class. Create transient attributes for the columns you need to display on the GUI.

If you open the EmployeesVOImpl class, you will see that JDev has extended it from oracle.jbo.server.ProgrammaticViewObjectImpl.

This class contains an overridden getScrollableData method, and this is the only method we need to populate in order to display data from the ref cursor. This method will be called when we call executeQuery method on the view object. Rest of the implementations are taken care of by the framework itself!

I created an integer variable departmentId (with setters and getters) in the VOImpl class, which will be populated from a value supplied from the GUI.

This is the required implementation in Application Module:

And that's all you need to do!