Oracle ADF Composite Primary Key

Oracle ADF Composite Primary Key


In this Post discuss about Oracle ADF Composite Primary Key Bug,


There is a bug in Oracle ADF when we have a composite primary key in table and we want to insert into to this column, especially when one of the primary key columns is foreign key,


Problem:

I made a sample for this problem.

1. We have two Table Organisation for Master Table and Bemerkung for Detail Table,(Master-Detail)


2. also there are two pages with one task flow.
Oracle ADF Composite Primary Key


3. In The Master page, there is a form for organization and table for bemerkung. via Edit button we go to the Detail page for edit the Bemerkung(Detail)
Oracle ADF Composite Primary Key


4.after click to Edit button we go to the Detail page. In this, via + Button we want to Insert into Bemerkung. Here Onr and Seite is Composite primary Key,
Oracle ADF Composite Primary Key


5.After insert automatically onr set with number becauase is master and get form master .
Oracle ADF Composite Primary Key


6. So we Enter the data for Seite and Name column.
Oracle ADF Composite Primary Key


7. After commit we see Exception like this two pictures,
Oracle ADF Composite Primary Key

Oracle ADF Composite Primary Key




This is the bug from ADF to support Composite Key.

Solution:

8.In viewobject Bemerkung we generate the viewimpl class.
Oracle ADF Composite Primary Key


9.In the findByKey method from this class we should Override it like below picture.
Oracle ADF Composite Primary Key


Again run the project and we can insert into Detail table without exception.







Comments

  1. this is not working same problem

    ReplyDelete
    Replies
    1. you should enable refresh after insert and after update for the fields

      Delete
  2. I believe it should actually be this
    Key correctKey =
    new Key(new Object[] { getCurrentRow().getAttribute("CnfrIntrNo"),
    getCurrentRow().getAttribute("CnfrDocNam") });
    return super.findByKey(correctKey, maxNumOfRows);

    ReplyDelete

Post a Comment

Popular posts from this blog

Oracle JET with Firebase Realtime Database (Part 1)

ADF Filter LOV View Object , af:selectOneChoice Programmatically