Sunday, June 16, 2013

Define Primary Keys for all View and Entity Objects

When working with ADF, it is best to AVOID ISSUES by doing the right thing. Now that is broad statement, but i will try to post my learning's on this Blog.
Each ADF View & Entity Objects must have Primary Key.
ADF Business Components will generally have Primary Key defined, when they are generated using "Business Components from Tables" wizard. But in other cases when you have Read Only or Transient View Objects, they will not have Primary Key by default.

For example, see following steps to create List of Values (SQL based) View Object.

Note that DepartmentId is not selected as Primary Key. Select "Key Attribute" check box for all attributes that are part of Primary Key for this particular View Object.

Now you can see DepartmentId is selected as Primary Key.

ADF uses Primary Key for selection process, so if you did not have proper primary key, you will see weird behavior in Table Selection.