This week i will continue to enhance my previous post (Moving to Jdeveloper11g Your First ADF Form) and today i will cover how to create LOVs in Oracle ADF application.
- HR Schema in Oracle database.
- Download this basic completed application and change the connection settings according to your environment.
On this post we will create LOVs for Job, Department Id in Simple Employee based form.
Note: (Manager LOV is little tricky i will cover in next post)
Steps to follow:
For good naming convention we will rename the adf.demo.model.view package to queries
- Right click on adf.demo.model.view in Model project and choose Re-factor > Rename and rename it to adf.demo.mode.queries
Adding Departments and Jobs Entities:
Note: If you already have entities in your project then you can skip to next step
- Add Departments Entity by Right clicking on adf.demo.model.entities package in Model project and choose New Entity Object
Enter Name as "Departments" and Choose Schema object as "Departments" by pressing Browse button you can select from the list of objects as well.
- 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 "DepartmentsLOV" and other options as shown in the slide.
- Repeat same steps for Jobs Choose JobId and JobTitle as Attributes and JobTitle as Order by.
- 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 DepartmentsLOV in Available Objects change the Name at the bottom to DepartmentsLOVAcesssor and Press > button to Create Accessor for LOV as shown in the slide click OK.
- Choose DepartmentId in List Attribute Return Values will populate automatically. Your Screen should similar to this.
- Go to UI Hints tab Leave the List type as Choice List (There are many type of LOVs available)
- Move Department Name from Available to Selected Area.
- Choose "Labeled Item(First of List)" at very bottom include "No Selection.." and set the Description as "
- Repeat Same Steps for JobId attribute.
Your EmployeeVO 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 and Right click choose Delete.
- Refresh the DataControl page
- Expand the DataControl > EmployeeVO select DepartmentsId attribute and Drag and Drop it to FormLayout.
- Menu will appear select Single Selection > ADF One Choice List as shown in the slide
Your JSF Page should looks like this
- Right click and Choose Run
Your Page should looks like this on Runtime
With Oracle ADF application development becoming fast easy and see how easy is to create LOVs in your ADF application as like in Oracle Forms.
You can Download my completed Application
Follow me on Twitter http://twitter.com/baigsorcl
Have a nice day,