Primary Key Importance for LOV View Object


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值