Yehia A. Khamees
Yehia A. Khamees

Reputation: 162

ADF CreateInsert Action adds two records in ADF Table

I am currently working on a project where the users require data entry screens modeled after a spreadsheet.

Everything was working fine and data entry was working as designed. All of a sudden whenever the user clicks on the button bound to the CreateInsert event, it adds two rows in the ADF Table instead of one.

Behavior screenshot: enter image description here

Moreover, when I attempt to rollback the ADF transaction, the number of records are multiplied. Meaning, I click Rollback bound button the records disappear. Then when I click CreateInsert again, I get 4 extra new records.

Multiplied records screenshot: enter image description here

JSF Page:

<af:commandButton actionListener="#{bindings.CreateInsert.execute}" text="#{label.strCreateNew}" styleClass="btnGeneral" disabled="#{!bindings.CreateInsert.enabled}" id="b1"/>

I have also attempted to override the CreateInsert event by writing my own code. It still exhibited the same behavior.

Custom Code:

 public void doAddNewRecord(ActionEvent actionEvent)
 {
    ApplicationModule am = null;
    try
    {
        am = ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
        ViewObject vo = am.findViewObject("NssFiuMnyLndryTrrFinView1");

        Row row = vo.createRow();
        vo.insertRow(row);
    }
    catch (Exception ex)
    {
        /*custom exception handling code*/
    }
 }

Any help would be really appreciated.

Thanks.

Upvotes: 0

Views: 429

Answers (1)

Belal Awwad
Belal Awwad

Reputation: 315

This means that you do not have a primary key in your View Object or the primary key has duplicate values

Upvotes: 1

Related Questions