Tuesday, May 4, 2010

Bit #16 - Removing a row from a query collection without deleting it from the database

There are times when you want to remove a row from a query collection (the query result) without actually removing it from the database. The query collection - oracle.jbo.server.QueryCollection - gets popullated each time the View is executed - when the View's associated query is run, and represents the query result. While the Row.remove() will remove the query collection row it will also remove the underlying Entity row - for an Entity-based View - and post a deletion to the database. If your programming task requires that the row is removed from the query collection only, i.e. removing a table row in the UI without actually posting a delete to the database, use the Row method removeFromCollection() instead. Just be aware that each time the View is re-executed the Row will show up once again!


        // in the context of the ApplModuleImpl

        // remove the current row from the query collection
        EmployeesRowImpl employee = (EmployeesRowImpl)(this.getEmployees().getCurrentRow());

        // the employee row has been removed from the result set and cannot be used anymore


Application Module Implementation Class
View Object Implementation Class


  1. Any way to remove row from read-only non entity based view?

  2. Answered my own question here


Related Posts Plugin for WordPress, Blogger...