Tuesday, July 17, 2012

Methods for : Create , Update , Delete in EO(Entity Object) in OAF

Methods for : Create , Update , Delete in EO(Entity Object) in OAF

1. Create : To  insert a new row in the EO based VO at last
    Use the below methods :
    /* Add New Row in the table */
    public void addNewRow() {
OADBTransaction txn = getOADBTransaction();
        EmpEOVOImpl vo = this.getEmpEOVO();
        vo.setMaxFetchSize(-1);
        EmpEOVORowImpl newAddRow = (EmpEOVORowImpl) vo.createRow();
        if (vo.getFetchedRowCount() < 1) {
            vo.insertRowAtRangeIndex(0, newAddRow);          
        } else {          
            vo.last();          
            vo.insertRowAtRangeIndex(vo.getRowCountInRange(), newAddRow);
            vo.next();        
        }//End else
    }//End addNewRow

2. For Update

/**to update the record **/
  public void updateRecord()
 {

  OADBTransaction txn = getOADBTransaction();
   txn.commit();
  }

3. For Deleting the selected row

public void deleteRow(Number   eno  )
 {
OADBTransaction txn = getOADBTransaction();
 EmpEOVOImpl vo = this.getEmpEOVO();
Rows [] rows = vo .getFilteredRows("Empno",  eno );
//the above object will contain the rows whose Empnois eno
EmpEOVORowImpl  empRow =null ; 
  for (int i=0;i< row.length; i++)
   {
     empRow =  rows[i];
     empRow.remove();
   }
   txn.commit();
}

  

No comments: