Wednesday, 22 August 2018

Commit in oaf

Commit in oaf

In this post, We will discuss , how we do commit in OAF. We need commit option during the DML operations. When you are creating the OAF page , which does DML operations then we need to put commit in oaf syntax in the applications Module (AM) of the Page. We will handle the commit operations in the AM of the Page. Here below I will share the same code for Commit in OAF , which helps to save the new record in the OAF Page.

Sample code for Commit in oaf for the Application Module

These are the two methods Written inside AM of the Page
public void createrecord()
{
  OAViewObject vo=(OAViewObject)getSupplierEntryVO();
 
  if(!vo.isPreparedForExecution())
  {
    vo.executeQuery();
  }
 
Row row=vo.createRow();

vo.insertRow(row);

row.setNewRowState(Row.STATUS_INITIALIZED);

}\\\

2.
public void saverecord()
{
  getTransaction().commit();
 
}
Commit in oaf

Then we will call these methods through Controller of the Page in OAF as below


  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule oa=(OAApplicationModule)pageContext.getApplicationModule(webBean);
    if(pageContext.getParameter("Save")!=null)
    {
    oa.invokeMethod("saverecord",null);
    }}

0 comments:

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *