How To: Perform "Date Conversion" in ADF/ OAF/ JAVA

I run into the struggle of converting one data type to another all the time. And obviously, I don't recollect instantly how to convert one from another. So here's some notes for me & hopefully they will useful for you as well.

// 1. Get Date from Calendar 
 int year=2016; int month=1; int date=1;
 Calendar cal = Calendar.getInstance();
 cal.set(year, month, date);
 java.util.Date utilDate = cal.getTime();

// 2. Convert java.util.Date to java.sql.Date
 java.util.Date utilDate = new java.util.Date();
 java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());

// 3. Convert java.sql.Date to oracle.jbo.domain.Date
 java.sql.Date sqlDate = new java.sql.Date();
 new jbo.domain.Date(sqlDate);
 /* To get current date & time in jbo.domain.Date */
 java.util.Date utilDate = new java.util.Date();
 java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
 oracle.jbo.domain.Date jboDate = new oracle.jbo.domain.Date(sqlDate);

// 4. Convert java.util.Date to java.sql.Timestamp
 java.util.Date utilDate = new java.util.Date();
 java.sql.Timestamp timestamp_now = new java.sql.Timestamp(utilDate.getTime())

Please share your feedback below. Hope you find this helpful!


OAF: CSS Classes for OA Components

Here is the link where all the OAF CSS classes for OA Components are published:

 Do not go by the look and feel of this page. The CSS classes will reflect the look and feel of your EBS environment.

Please share your feedback below. Hope you find this helpful!


How To: Redirect to a new page in OAF

The method pageContext.setForwardURL() is to redirect to a new page. There are several ways in which the method can be used in your controller class:

Option 1:

 //Create HashMap to include destination page parameters
 HashMap hm = new HashMap();

 //Forward to destination page
  "OA.jsp?page=/xxcc/oracle/apps/ar/demo/webui/myDemoPG", // Path to the destination page
  null,  // No need to specify with KEEP_MENU_CONTEXT
  OAWebBeanConstants.KEEP_MENU_CONTEXT, // No change in the menu context. Keep same as source page 
  null,  // No need to specify with KEEP_MENU_CONTEXT
  hm,  // HashMap with page parameter
  true,  //Retain AM state.
  OAWebBeanConstants.ADD_BREAD_CRUMB_YES, //Show breadcrumbs
  OAWebBeanConstants.IGNORE_MESSAGES //Ignore any messages

Please share your feedback below. Hope you find this helpful!


How To: Remove all rows from view object (VO) in OAF & ADF

Option 1: 

The executeEmptyRowSet() method can be used to empty the VO. This is my preferred approach.
    /* Use the following snippet in the Application Module (AM) */
    OAViewObjectImpl vo = this.getMyDummyVO();

Option 2: 

Loop through the VO and remove each row. If the data set is too large this could be cost intensive. I do not prefer this option.
    /* Use the following snippet in the Application Module (AM) */
   OAViewObjectImpl vo = this.getMyDummyVO();

Please share your feedback below. Hope you find this helpful!


OAF: How to find the OAF Developer's Guide

The OAF Developer's guide is the bible for OAF developers.

The document 131548.1 has the OAF developer guides for all Oracle EBS versions until date.

Happy coding!

Let me know if you need help with something!


OAF: Create a new OA Workspace & Project

Follow these steps to create a new OA Workspace and Project:


  • Determine the version of the Oracle EBS environment. (Example: R12.2.4) 
  • Determine the JDeveloper version to be used for the corresponding EBS environment using Note 416708.1

1. Create OA workspace

  • Right click on Applications > Select New OA Workspace
  • Enter the Name of the Workspace (Example: Demo.jws) 
  • Select the Checkbox "Add New OA Project" 
  • Click Ok

2.  Create OA Project

  • On clicking ok, in the prior step the OA Project wizard should launch
  • Enter the Name of the Project (Example: myDemo.jpr)
  • Provide a default package if required (Example: com.myDemo)
  • Provide a design time DB Connection 
    • Select the checkbox Use Repository for Design Time
    • Select the DB Connection from DropDown OR Click New to create a new DB connection
  • Provide Run Time Configuration
    • ** This step is optional at this time but you will need to do this if you want to run your pages locally in JDeveloper **
    • Enter the following for each of the fields:
      • DBC File - This file can be obtained from the FND_TOP of the EBS environment.
      • Username - Enter the oracle apps username (Example: operations)
      • Password - Enter the oracle apps password (Example: welcome)
      • Responsibility Key - The responsibility key within which you want to run the page. (Example: APPLICATION_DEVELOPER)
      • Application - The application within which the responsibility is defined (Example: FND)

Please share your feedback below. Hope you found this helpful!


SQL: Create a new user/schema in Oracle

Use the following script to create a new user/schema XDUMMY. Run these scripts as the SYS user:

/* Script to create new user with username XDUMMY and password xdummy */


/* Script to grant session and create privileges to new user */

GRANT create session TO XDUMMY;
GRANT create table TO XDUMMY;
GRANT create view TO XDUMMY;
GRANT create any trigger TO XDUMMY;
GRANT create any procedure TO XDUMMY;
GRANT create sequence TO XDUMMY;
GRANT create synonym TO XDUMMY;

/* Create new objects in schema */

// Connect to DB as as xdummy/ xdummy
create table dummy_tbl (...);

/* Create synonym so that you can query from other schemas */

create public synonym dummy_tbl for xdummy.dummy_tbl;

/* Query your objects from another schema. Example: APPS*/

// Connect to DB as as apps/<apps_pwd>
select * from dummy_tbl;

Please share your feedback below. Hope this is helpful!


SOA: Fault Handling: Creating a fault policy

Fault handling is a very interesting concept in SOA. It is analogous to Exception Handling per OOPs concepts.

Fault Policy is defined to handle runtime fault exceptions. You can define actions to execute based on the type of exception. Here's a 1-0-1 on defining a simple fault policy:

1 -  Create the fault-policies.xml file

Right Click on the Project > Select From Gallery > Select SOA Tier/Faults > Fault Policy Document > Click Ok

This creates a fault-policies.xml within the project/SOA folder.

2 - Editing the fault policy

Open the fault-policies.xml to edit the fault policy.

Provide a unique ID to the fault policy:
<faultPolicy id="MyFaultPolicy">

Let's define the fault policy to retry 3 time at a interval for 120 sec for any runtime fault:

        <action ref="ora-retry"/>

This means for any fault (since no name is specified) the action "ora-retry" will be executed. The action "ora-retry" is a custom action here. We will need to define what ora-retry means.

3 - Define ora-retry

Add the following action to the fault policy file.

<Action id="ora-retry">
        <retryFailureAction ref="default-terminate"/>

4 - Review the Fault Policy

Here is how the fault-policies.xml document looks:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="" xmlns:bpelx="" xmlns:medns="" xmlns:rjm="">
    <faultPolicy id="MyFaultPolicy">
                    <action ref="ora-retry"/>
            <Action id="default-termination">
            <Action id="ora-retry">
                    <retryFailureAction ref="custom-java-send-email"/>
                    <retrySuccessAction ref="default-termination"/>

5 - Create the Fault Bindings

Now the fault policy is created. However, the job is not done yet. We need to associate the fault policy to the composite. Thus, whenever there is a fault in the composite the fault policy "MyFaultPolicy" will be invoked.

To do this we need to create the fault-bindings.xml file within Project/SOA folder as follows:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1" xmlns="">
    <composite faultPolicy="MyFaultPolicy" />

Please share your feedback below. Hope this is helpful!


How To: Throw a custom fault/ exception in BPEL (SOA-Fault Handling)

Fault Handling in SOA is analogous to Exception Handling in OOPs. Below is how to throw a fault in a BPEL process:

1 - Define the fault message type

Add the RuntimeFault.wsdl to the Project/SOA/WSDLs folder. This WSDL contains the message definition of the fault that will be thrown at runtime.

<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="RuntimeFault" targetNamespace=""
             xmlns:xsd="" xmlns="">
    <message name="RuntimeFaultMessage">
        <part name="code" type="xsd:string"/>
        <part name="summary" type="xsd:string"/>
        <part name="detail" type="xsd:string"/>

2 - Define the fault variable to hold the fault

Define a new BPEL variable with the message type "RuntimeFaultMessage" created in the step above.

Variable Name: faultVar
Type: Message Type
Local Part: RuntimeFaultMessage

3 - Create a throw activity

Drag and Drop the "Throw" activity from the Components Menu into your BPEL process.

Activity Name: ThrowFault
Namespace: <Target Namespace of your BPEL process>
Local Part: <Name the Fault>
Fault Variable: faultVar (fault variable created in the step above)

Hope you find this information useful.Please share your feedback below. I would love to hear from you.