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)
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)
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,
5.After insert automatically onr set with number becauase is master and get form master .
6. So we Enter the data for Seite and Name column.
7. After commit we see Exception like this two pictures,
This is the bug from ADF to support Composite Key.
Solution:
8.In viewobject Bemerkung we generate the viewimpl class.
9.In the findByKey method from this class we should Override it like below picture.
Again run the project and we can insert into Detail table without exception.
this is not working same problem
ReplyDeleteyou should enable refresh after insert and after update for the fields
DeleteI believe it should actually be this
ReplyDeleteKey correctKey =
new Key(new Object[] { getCurrentRow().getAttribute("CnfrIntrNo"),
getCurrentRow().getAttribute("CnfrDocNam") });
return super.findByKey(correctKey, maxNumOfRows);