This blog is concerned with the ADF/BPM technology provided by Oracle. I Hope this blog helps fellow Oracle ADF/BPM Developers

Thursday, December 2, 2010

Calling SQL Statment Inside Java Code

One of the important way for developing is calling a sql statment inside your java code and I will explain how to do this:1- call a select statment
asume we want to make a function take department Id and return its name so we will make this function

2- Call an updatable statment as (Create, Insert, Update and Delete)asume we want to make a function take department id and delete it

where getAm() is a method return your Application Module as :

If you want to use java connection (don't want to use AppModule) you can use something like this:

7 comments:

Hi Suresh,getAm() is a method that return your Application Module. In getAm() method you should write your Data Control Name as "AppModuleDataControl" so the method will bepublic AppModuleImpl getAm(){AppModuleImpl am =(AppModuleImpl) ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");return am;}

and about this line :stat = getAm().getDbtConnection().createPreparedStatement(sql, 1);

Second: how you call the method in AppModuleImpl from bean??You can't instantiate an application module to access method. you should expose the method to the clientinterface of the application module and add it in the pageDef. then you can call this method like:BindingContainer bindingContainer= BindingContext.getCurrent().getCurrentBindingsEntry();OperationBinding operationBinding=bindingContainer.getOperationBinding("methodAction");operationBinding.execute();