Tuesday, 6 August 2019

Logic for insert data in Database in OAF

1. First, we have to write one new method in AMImpl class for creating new record

public void InsertRecord()
{
 InsertVOImpl vo= getInsertVO1();
 OADBTransaction trans= getOADBTransaction();
 vo.executeQuery();
 Row v_row;
 v_row = (Row)vo.createRow();
 vo.insertRow(v_row);
}

2. In controller,  we have to initialise the AM in processRequest

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processRequest(pageContext, webBean);
 InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
 am.InsertRecord();  /* Name of the method which we created in AM */
}

3. In processFormRequest, we have to write code for save the record into database.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processFormRequest(pageContext, webBean);
 InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
 if(pageContext.getParameter("item")!=null)
 {
 am.getOADBTransaction().commit();
 throw new OAException("Employee Created sucsessfully",OAException.CONFIRMATION);
 }
}


thats it 

1 comment:

  1. Casinos in the UK - How to find good games - GrizzGo
    So, what do we mean by “casinos https://febcasino.com/review/merit-casino/ in the UK”? to find choegocasino.com사이트 a casino and live casino games on a mobile 메리트카지노 phone device gri-go.com in 2021.

    ReplyDelete