Search code examples
oracle-adf

Search (UI) on employee table with the department name and not department ID


Say I have two tables Employee and Department. Employee table has departmentID which references the Department table.

I would like to implement search functionality on the employee table based on EmployeeName and DepartmentName. I've implemented the search on EmployeeName by adding a view criteria on the Employee VO. How do I search department name if I can only add departmentID in the view criteria.

I don't want to search with department ID since my users wont know the IDs of each department but they do know the name.


Solution

  • "How do I search department name if I can only add departmentID in the view criteria?"

    I assume you can only add departmentID because it's the only attribute of your View Object. Here it look like you are confusing view object and entity object in oracle adf.

    In oracle ADF your Entity object will map your database object. So in your case you'll have 2 Entity Object, one for the employee table and another for the department table.

    Your View Object here can join both Entity Object Value. So in your case you'll create a view object that is base on your Employee and Department Entity Object with a correct join on your departmentID attribute.

    This View Object now have all the attributes from both Entity Object (and Table) so you can create a View Criteria with the attribute you are interessted in.