Tuesday, November 19, 2013

ADF: postChanges delete parent and children in the same transaction programmatically

I was doing a simple mater details delete with some code and no matter what I did the parent delete got called before the child, then I remembered post changes (this.getDBTransaction().postChanges();) and called it after deleting the children. And that is how postChanges saved my life.

Code for fun...

        Key key = new Key(new Object[] { objectId });
        Row[] rows = getParentVO().findByKey(key, 1);
        if (rows != null && rows.length > 0) {
            ParentVORowImpl parent = (ParentVORowImpl) rows[0];
            RowIterator rowIterator = parent.getChildVO();

    public void removeRows(RowIterator rowIterator) {
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();

No comments:

Post a Comment