Display root node of Hierarchical Tree using ADF - EJB DC
- by arul.wilson(at)oracle.com
Displaying Employee (HR schema) records in Hierarchical Tree can be
achieved in ADF-BC by creating custom VO and a Viewlink for displaying
root node. This can be more easily done using EJB-DC by just
introducing a NamedQuery to get the root node.Here you go to get this scenario working.Create DB connection based on HR schema.Create Entity Bean from Employees Table.Add custom NamedQuery to Employees.java bean, this named query is responsible for fetching the root node (King in this example).
@NamedQueries({ @NamedQuery(name = "Employees.findAll", query = "select o from Employees o"), @NamedQuery(name = "Employees.findRootEmp", query = "select p from Employees p where p.employees is null")})
Create Stateless Session Bean and expose the Named Queries through the Session Facade.Create Datacontrol from SessionBean local interface.Create jspx page in ViewController project.Drop employeesFindRootEmp from Data Controls Palette as ADF Tree.Add employeesList as Tree level rule.Run page to see the hierarchical tree with root node as 'King'