Thursday, July 18, 2013

Remove/Delete all rows from Master-Detail ViewObjects ADF

 
*method in AMImpl to delete the rows from view object

public String removeRows(BigDecimal bindId){
        DCInspExampleVOImpl exVO=(DCInspExampleVOImpl) this.getDCInspExampleVO();
        DCInspExampleDetailsVOImpl ex etVO=(DCInspExampleDetailsVOImpl) this.getDCInspExampleDetailsVO();
        exVO.setBindId(bindId);
        exVO.executeQuery();
        while(exVO.hasNext()){
            DCInspExampleVORowImpl exRow=(DCInspExampleVORowImpl) exVO.next();
            exDetVO.setBindEnfId(exRow.getInspectionExampleId());
            exDetVO.executeQuery();
            RowSetIterator row = exDetVO.createRowSetIterator(null);
            while(row.hasNext()){
                row.next();
                 row.removeCurrentRow();
            }
            exVO.removeCurrentRow();
        }
             exVO.closeRowSetIterator();
             row.closeRowSetIterator();

        this.getDCInspExampleVO().getDBTransaction().commit();
        this.getDCInspExampleDetailsVO().getDBTransaction().commit();
        return null;
    }

2 comments:

Anonymous said...

Be sure to close any RowSetIterators you create.

Vijay Sadhu said...

Sure.