Saturday, August 02, 2008

Calling a PL/SQL function from ADF using JDeveloper 11G TP4

I will go over how to call a PL/SQL function from Jdeveloper 11G Tp4

First create a function that you will use , for this I used JDeveloper's database editor

Then create an ADF project and an Application Modulu within the new project. Follow the wizard until the Java screen, there we need to
check the first check box to generate the Java class file for the application module.

Once you are done with the wizard you will see that a Java file was created under the application module.

Edit this file and add the a public method to call the PL/Sql API. For more information you can check the developer's guide documentation.

Now we need to expose this function .
To do this edit the application module and go to Java tab. There click the pen for client interface. You should the newly created function on the left side. Select it and move it to right.

After completing the previous step you
should be seeing your function under Data controls.

Everything is ready now. We need to create a page and drag and drop the data control on to the page

While dropping the data control on toyour page select ADF Parameter Form from the coming menu as in the left picture.This will create the form to call your function.

Once the form is created there is one more thing to do. We need add a field to see the result of the
function. To do this drag and drop the String item on the data control on your page as an output field as on the left.

Now we can run our page and test it.


Jagadish said...

Hi Soyer,

Very good blog. Good layout and lots of useful information!

Keep it alive and kicking...


TestUpfna said...

Nice one but i have one additional requirement, I need to add List of values to populate to input parameters, how would i do it using Parameter form?

Muhammed Soyer said...

There is no straight way to that. You may create a transient view object and define your LOV there.

kin said...

Hi soyer,

Nice one but i have one function with 2 in and out paramater. How to do that . Thank You.

Renan said...

Hi Soyer,
Thanks for the hint!
But it is possible to do that using EJB3/JPA?