This discussion is archived
6 Replies Latest reply: Feb 7, 2013 6:10 AM by 985680 RSS

delete a row in and ADF table

985680 Newbie
Currently Being Moderated
Hi all, I am using jdeveloper 11.1.2.3.0

I am trying to delete rows from a table. I am selecting the rows by a check box. the rowselection property is multiple and I created a transient attribute.
the method that handles the delete is ino the VO java class. My problem is when I select more than 1 row the process does not succeed. But when I select 1 row the process succeed. Also , sometimes I got this error : JBO-27102: Attempt to access dead view row of persistent id 6

the method is :
    public void deleteSelectedRows(){
       
        RowSet duplicateRowSet = this.createRowSet("duplicateRowSet");
        duplicateRowSet.first();
        Row currentRow = this.getCurrentRow();
        boolean currentRowDeleted = false;
     
   Row[] rowsToDelete = duplicateRowSet.getFilteredRows("MarkedForDelete", true);
    
    if (rowsToDelete.length>0) {

            for (Row rw : rowsToDelete) {
               
                if (rw.getKey().equals(currentRow.getKey())) {
                    currentRowDeleted = true;
                }
               
                rw.remove();
            }
          
            this.executeQuery();
           
            if (!currentRowDeleted) {
                this.setCurrentRow(currentRow);
            }
            duplicateRowSet.closeRowSet();
        }
    }
  • 1. Re: delete a row in and ADF table
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    have you debugged the class to see what the count of "rowsToDelete" is? If the transient information about the rows to delete is lost, you can try and base the transient attribute on a transient attribute in the entity so the changes are persisted in the entity cache (which I can imagine may be the problem)

    The JBO-27102: Attempt to access dead view row is when a deleted entity is attempted to be accessed through a VO. So you need to make sure the web side iterator is refreshed as well

    Frank
  • 2. Re: delete a row in and ADF table
    985680 Newbie
    Currently Being Moderated
    Hello Frank , thank you for your reply. I am using now a method suggested by Timo
        public void deleteSelectedRows(){
        
                RowSetIterator delRowIter = this.createRowSetIterator("del_me");
                while (delRowIter.hasNext()) {
                    Row row = delRowIter.next();
                    if (true == row.getAttribute("MarkedForDelete")) {                  
                        row.remove();    
                    }
                }
    I am not getting the error and I am able to delete more than 1 row. But the new problem is , If I create a new rows and try to delete them they are deleted from the view but not from the database.
    to delete them from the database , I need to restart the application and delete them.

    any idea?


    thanks in advance


    FARAJ
  • 3. Re: delete a row in and ADF table
    Timo Hahn Oracle ACE
    Currently Being Moderated
    Do you commit the remove somehow?

    Timo
  • 4. Re: delete a row in and ADF table
    985680 Newbie
    Currently Being Moderated
    yes after the delete I click a button ( commit ) and after the create also.

    Regards,
  • 5. Re: delete a row in and ADF table
    Timo Hahn Oracle ACE
    Currently Being Moderated
    Any error messages from the commit? Otherwise hte rows should be delete from the db too.

    Timo
  • 6. Re: delete a row in and ADF table
    985680 Newbie
    Currently Being Moderated
    No errors from the commit.

    when I create a new row and commit , the row is displayed and the row is in the DB.
    If after that , for example , I select all the rows to delete them, all the rows are deleted from the view, but the newly created rows are still in the DB.

    I even have a search option in my application, If I search for all the rows before I try to delete them and then go and delete, all the rows are deleted even the newly created.

    Regards,

    Edited by: Faraj on Feb 7, 2013 6:09 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points