您的位置:首页 > 产品设计 > UI/UE

How to set the sequence value while saving the record in OA Framework

2010-11-26 11:33 531 查看
This is a requirement where people are used to Oracle forms style generation of unique number.The unique identifier for the record is derived from a database sequence when user saves the record in an OAF page.Most of the OAF pages developed by me has the sequence automatically generated in the Create method of the EO when user navigates to the screen.

Drawback of that approach is if user navigates to the create t screen and doesn't click on apply button then the sequence value will elapse and wasted.To avoid this ,follow the approach below to simulate the Forms Style Generation of the unique Number.

In your entity object EOImpl.java write the below code.

Previous Approach :

public void create(AttributeList attributeList) {

super.create(attributeList);

OADBTransaction transaction = getOADBTransaction();

Number seqNo = transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");

setFileId(seqNo);

}


New Approach : Write the code in the setter method in EO.

public void setFileId(Number value) {

if (value == null) {

OADBTransaction transaction = getOADBTransaction();

value = transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");

  }

setAttributeInternal(FILEID, value);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐