X
  • ADF
    February 7, 2011

Display root node of Hierarchical Tree using ADF - EJB DC

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.

EJBDC-HierarchicalTree_SessionFacade.JPG



  • Create Datacontrol from SessionBean local interface.

EJBDC-HierarchicalTree_Datacontrol_Contextmenu.JPG


EJBDC-HierarchicalTree_Datacontrol_LocalInterface.JPG


  • Create jspx page in ViewController project.
  • Drop employeesFindRootEmp from Data Controls Palette as ADF Tree.

EJBDC-HierarchicalTree_Datacontrol_ADFTree.JPG


  • Add employeesList as Tree level rule.

EJBDC-HierarchicalTree_EditTreeBinding.JPG


  • Run page to see the hierarchical tree with root node as 'King'

EJBDC-HierarchicalTree_Runtime.JPG




Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.