Workaround for LOV on Primary Key Attribute


There is a problem with LOV component, when it is defined on Primary Key attribute - registered Bug #8275169. Until problem will be fixed, workaround can be as following - to define second dummy transient attribute for Primary Key attribute and use it on the page. However, during commit - in doDML method on Entity to substitute real attribute value with value from transient attribute.

For example, Entity with Primary Key attribute DepartmentId:


I have defined LOV for this attribute in VO and on runtime trying to use LOV:


However unsuccessfully, error is generated:


You can download sample application -  LOVPrimaryKey.zip , where described workaround is implemented.

To give you more light about workaround, I will explain it in detail.

First, Primary Key attributes always are with Mandatory validation rule, however I removed this rule from DepartmentID and declared it for my transient attribute DepartmentId_Dummy. It is done in order to remove unnecessary check, since we are creating mirror attribute:


In getter method for transient attribute I need to return real attribute value during first load in order to display not blank values but correct ones:


In overridden doDML method value from transient attribute is copied back to real attribute:


DepartmentId attribute Display Hint is set to Hide - this means will not be visible in ViewController:


Transient attribute will be visible with user friendly label:


When developer will drag and drop Data Control on the page, wizard will not list original DepartmentId attribute, because it was set as Hide:


Now LOV will work, however I strongly believe this bug will be fixed in next build and there will be no need to apply this workaround !


URL: http://andrejusb.blogspot.jp/2009/02/workaround-for-lov-on-primary-key.html


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值