Create List of Values - LOV in Oracle ADF

In this post i will continue to enhance my previous post's Employee Form and create my first List of Values (LOV) in Oracle ADF Form. Creation of LOV in ADF is as simple as in Oracle Forms. In this post i am going to create LOV for Department and Job entities. Do the following steps to create LOV in ADF.


1) Add Departments and Jobs Entities
2) Add View Objects for Departments and Jobs LOVs
3) Create LOVs
4) Finally Link LOVs to JSF Page

Right click on adf.demo.model.view in Model project and choose Re-factor than Rename the  adf.demo.model.view to adf.demo.mode.queries for good naming convention.

Adding Departments and Jobs Entities

Right clicking on adf.demo.model.entities package in Model project and choose New Entity Object to Add Departments Entity.



Enter Name as DeptLOV and Choose Schema object as DEPARTMENT


Choose All columns in attributes page and click Finish


Repeat the same step for Jobs entity

Adding View Objects for Departments and Jobs LOVs

Right click on adf.demo.model.queries package and Choose New View Object


Enter name as DeptLOV and Click Next


Select the DeptLOV entity and move to selected area. Uncheck the Updatable option also


Select all Attributes to Selected area


Choose Dept ID in Order by section by pressing EDIT button and Click Finish


Repeat same steps for Jobs LOV

Creating LOVs

Double click EmployeeVO in adf.demo.model.queries section.Select DepartmentId attribute in the attribute page and Click "+" green button at the bottom under List of Values section


Click the green + button with List Data Source. Select DeptLOV in Available Objects change the Name at the bottom to DeptLOVAcesssor and move it to View Accessors to Create LOV


Choose Dept in List Attribute Return Values will populate automatically


Go to UI Hints tab Leave the List type as Choice List . Move DeptName from Available to Selected Area. Choose Labeled Item(First of List)  at very bottom include No Selection..  and set it accordingly


Repeat Same Steps for JobId attribute

Your EmpView page should looks like this


Linking LOVs to JSF Page

Open employee.jspx page in View Controller Project. Delete JobsId and DepartmentId attribute by selection them in Structure Window


Refresh the DataControl page. Expand the Data Control, Select DepartmentsId attribute from EmpView and Drag and Drop it to FormLayout. Menu will appear select  ADF One Choice List from Single Selection


Repeat the same step for JobId and adjust entities accordingly on your AFD Form. Now Finally Right click and Choose Run. Your Page should looks like this on Runtime




Comments

Popular posts from this blog

Create Tables in Oracle Database using TOAD

How to create Oracle stored Procedures using TOAD for Oracle

How to Create Packages in Oracle Database using TOAD for Oracle