Keep in mind, if you want to enable ADF Faces LOV component for autocompletion - you must have primary key defined for LOV View Object (even this View Object is readonly). Otherwise, ADF Faces LOV component may not function properly - new value will not be accepted and reverted back to original one.
I will demonstrate such behavior in this sample app - LOVPrimaryKeyApp.zip .
Originally, LOV VO didn't had any primary key defined - we will test how it works:
LOV VO is defined for JobId attribute:
ADF UI is set with AutoSubmit=True property for LOV component:
LOV field originally is loaded with AD_VP value:
We change it to be IT_PROG and tab out:
From the log we can see ADF executes two SQL statements - first it filters by IT_PROG and then suddenly it executes same SQL but without bind variable - its where new value is lost and LOV is reset back to original value AD_VP:
This happens because ADF tries to validate new value and execute findByKey method for that reason. However, if there are no key defined on LOV VO - it fails to execute findByKey and performs blind SQL execution without any bind variables at all. Value is reset back to original - AD_VP:
Let's set primary key for LOV VO - JobId:
Finally now findByKey is executed correctly, because LOV VO contains key attribute. New value was validated correctly and accepted - see second SQL:
There is still a big mystery why ADF executes two SQL statements to validate new value for LOV. We would need to dig into ADF source code to understand that.
origial url: http://andrejusb.blogspot.jp/2012/10/primary-key-importance-for-lov-view.html