Execute a PL/SQL stored procedure when starting an ADF application

How to execute a PL/SQL stored procedure when starting an ADF application?


This topic is discussed already in few other blogs, where they addressed this scenario with phaseListener and  Invoke Method of task flow.

Here I am addressing the same, calling a PLSQL procedure or some relevant methods that needs to called during the ADF application start up using AM method.

Application Module has a  secure method called Create which gets called during the ADF Application start-up, so I overridden the method create in Application module. 

Detail Steps below:

  • Open the AM by double click on its icon in the Application Navigator panel.
  • Open the "Java" tab in the AM.
  • Click the "Edit Java Options" button (pencil icon in the upper-right corner)
  • Check the "Generate Application Module Class:" option and click OK


    • Open the generated java class in the editor, and on the right mouse button popup menu on the source, select "Source" -> "Override Methods" , and select the "create" method.

    • Inside the generated method body and below the super.create(); insert the code to call the stored procedure.

        @Override
        protected void create() {
            System.out.println("Inside Application Module Create");
            super.create();
            
        }


    During the ADF application start up - you can check the log for the message.



    For more information on how exactly to call your stored procedure, please select the appropriate code pattern depending on the in/out parameters, as per ADF documentation: 

    Invoking Stored Procedures and Functions



    No comments:

    Post a Comment