Monday 4 June 2012

How to Directly insert or update values in DB using Connection and Statement classes using OADBTraction object in OAF Page


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
   
    if(pageContext.getParameter("Test")!=null){
    System.out.println(" I am  in if condition of Test Button");
OAApplicationModule am=pageContext.getApplicationModule(webBean);

try{
Connection conn =am.getOADBTransaction().getJdbcConnection();
Statement stmt = conn.createStatement();
int r=stmt.executeUpdate("update employeerequisitiondetail  set commentsByDepttNHR='Testing2' where employeerequistionno='41'");
System.out.println("I am in TOP ProcessFormRequest  Succesfully if result ====="+r);
am.getOADBTransaction().commit();
stmt.close();
}catch(Exception e){System.out.println(e.toString());}
    }

   }

No comments:

Post a Comment