Tuesday, February 11, 2014

LOV (List of Values) using EJBs

Following a request, I would like in this post to demonstrate how to use EJBs to build your business services and how to build a simple form with a list-of-value component (using the selectOneChoice component).

 I created an application using the "Fusion Web Application (ADF)" template, i initialized my model project by creating a database connection to the HR schema and created two EJB entities, one for the Employees table and one for the Departments table.


I created a session bean using the default settings (with all methods from both entities being selected) and generated a data control from the session bean by just right-clicking on the session bean and selecting from the context menu "Create Data Control".


I created a page (employees.jspx) and dropped the employeesFindAll collection on the page as a form (for demo purposes i am just using three attributes: EmployeeId, FirstName and LastName). The initial requirement was instead of displaying the department id to have a drop down displaying the department name.

When you created the EJB entities from table, ADF interrogated the database catalog and identified the relationship between the two tables, thus injecting it into the Employees EJB.


To add the department name as a list-of-value just drag and drop onto your page the nested departments collection as an ADF Select One Choice component.

Run the employees page and you will see that ADF will synchronize the department list as you navigate between different employees.


Download sample application: LOVsUsingEJBs

Wednesday, February 5, 2014

Working with the selectManyCheckbox component

I recently came across a simple, yet not so straightforward use case as it seems for many ADF developers on the JDeveloper & ADF forum so I decided to blog about it.

The requirement was to use the selectManyCheckbox component and to save the selection in the database in a varchar2 column of type.

So I created a custom table in the HR schema, MY_EMPLOYEES with 3 columns; ID (number), NAME (varchar2) and  DEPARTMENTS (varchar2).


I then created the basic ADFBC objects (an entity MyEmployees based on the MY_EMPLOYEES table, a view MyEmployeesView based on the MyEmployees entity and an application module AppModule that has the MyEmployeesView selected in the data model).


Moving on the ViewController project, i created a page (employees) where i dragged the MyEmployeesView view object as an ADF Form (JDeveloper created automatically for me the 3 attributes Id, Name and Departments).

From the component pallet i added  a selectManyCheckbox component, accepting the default settings (just changed the label to Departments) and a button component (which i called Save).


In the page bindings I just added the Commit operation as an action (so that i can invoke it from the Save button).

All the logic is implemented in a managed bean with scope set to pageFlowScope. Both the selectManyCheckbox and selectItems values are set from the bean. 



Same goes with committing the data (selected departments). This is handled via a bean method.

  
You can test the application by running the employees.jspx page. Select one or more departments and click save. The selection array is stored in the varchar database column.


On loading the page the bean will convert the string back into an array and assign it to the selectManyCheckbox component.

Download Sample Application - WorkingWithTheSelectManyCheckboxComponent

Tuesday, February 4, 2014

Oracle Fusion Middleware Partner Community Forum 2014

Hi everyone,

This year Oracle is organizing its Oracle Fusion Middleware Partner Community Forum in Malta. The event is going to be held on February 18th and 19th 2014 with hands-on training on February 20th & 21st 2014.

The event is a great opportunity to learn about:
  • SOA Suite 12c & Cloud integration
  • BPM Suite 12c & Adaptive Case Management 12c
  • Internet of Things & mobile strategy & fast data
  • WebLogic 12c the foundation of Oracle Fusion Middleware
Oracle will be running the following hands-on bootcamps:
  • Internet of Things (IoT) hands-on Bootcamp
    • Trainer: Harish Gaur, Director Product Management at Oracle
  • Coherence 12c hands-on Bootcamp
    • Trainer: Maciej Gruszka, Senior Principal Product Manager at Oracle
  •     Mobile Platform Cookbook Concepts and Practices Workshop
    • Trainer: Frank Nimphius, Principal Product Manager at Oracle
  • Adaptive Case Management hands-on Bootcamp
    • Trainer: Niall Commiskey, Technology Architect
Don't miss this unique experience.

See you all in Malta!