Thursday, September 1, 2016

After Commit extra empty rows are getting created



Recently In our project we came to a strange  situation where if user is creating new rows and committing the data to database. After commit operation its creating empty rows (count is equal to newly created rows).

Its because of one Entity instance data has been shared by multiple VO instancces.

This is a strange behavior of ADF VO. the reason behind this behavior is data shared between VO instances like if there were multiple instances of the same VO i.e, iterators data shared between those iterators.

the solution is straight forward, like it can be done at 2 levels. Like 1. Application Module Level

2. VO Impl class Level.

1. Application Module:

If we want to apply this at all view objects of the application. Then we can go for this option.

In application module we have a property jbo.viewlink. consistent . the default vlaue is true (DEFAULT) we need to change this property to false as shown in below image. B


2. VO Impl class Level:

In VO Impl we need to override the rowQualifies life cycle method. To display the rows which are not modified.

    @Override
    protected boolean rowQualifies(ViewRowImpl viewRowImpl){
        EntityImpl primaryEntity = viewRowImpl.getEntity(0);
        if(primaryEntity !=null && primaryEntity.getEntityState()!=Entity.STATUS_UNMODIFIED){
            return false;
        }
        return super.rowQualifies(viewRowImpl);
    }


that's it Its working simple tip but saved lot of time. It might be helpful to you.

No comments:

Hide Query By Example of PanelCollection on page load

Hi All, If there is a table with filterable is true. If you want to display QueryByExample then surround this table with panelCollection....