Skip to main content

Posts

Showing posts from January, 2009

Debug OAF-7 ways

1. Use System.out.println When running the OA Framework pages from jDeveloper itself, you can write debug messages using System.out.println. These debug messages will be displayed in the console of jDeveloper. Pro * Ease of use, as you simply enter free text messages * Debug messages simply appear without the need to set any profile optionsCons * Too much typing, which can be avoided when using the debugger of jDeveloper. * You can debug only those pieces of code that you suspect are causing the error. Unlike to this approach, using jDeveloper debugging, breakpoints can be set for exceptions/classes as well. 2. Use jDeveloper inbuilt Debugger This happens to be my favourite mechanism to debug OA Framework Pages, for the following reasons Pro * To get started just one breakpoint is required, as more and more breakpoints can be added in runtime itself. * You can set generic breakpoints, for example, you can set breakpoint on exceptions, w

Call PLSQL in OAF

Calling PL/SQL Functions and Procedures Even when writing Java entity objects, you might need to call PL/SQL functions or procedures. Note: Do not use JDBC to perform simple SQL statements. Always leverage view objects for this purpose. If possible, you should define the view object declaratively. In general, to invoke a stored procedure from within an entity object or an application module, you need to: Create a JDBC CallableStatement with the PL/SQL block containing the stored procedure invocation Bind any variables. Execute the statement. Optionally retrieve the values of any OUT parameters. Close the statement. The following application module example shows how to create and use a CallableStatement in an entity object. import java.sql.CallableStatement; import java.sql.SQLException; import java.sql.Types; ... OADBTransaction txn = getDBTransaction(); CallableStatement cs = txn.createCallableStatement("begin dbms_application_info.set_module(:1, :2); end;");