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 :
New Approach : Write the code in the setter method in EO.
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);
}
相关文章推荐
- How to set the style in valuelist
- Here's an example that shows how to enumerate through the features of a selection set, returning the value of each field in the attribute table except for the geometry colum.
- whatever how, this should be record and be researched later. ---- about how to enable gpio value set in mach_smdk6410.c
- How to correctly set application badge value in iOS 8?
- How to get and set the drawing order of layers in globe(获取并设置Globe图层的叠加次序:)
- how to get the return value from a thread in python?
- How to sort a Map<Key, Value> on the values in Java?
- How to set the QT Application icon in the windows.
- How to set the JAVA_HOME variable in Mac OS X – Snow Leopard
- (C#) A demo on how to auto fill out the "account" value in log in web page in "WebBrowser" control.
- django: BooleanField, how to set the default value to true? - Stack Overflow
- How to set the default input focus on a field in an HTML web form
- how to set value for cmake arguement in command
- How To Set Dark Theme in Visual Studio 2010
- How to set up OpenERP for various timezone kindly follow the following steps to select timezone in OpenERP
- Parsing Failure in config.xml: java.lang.IllegalArgumentException: In production mode, it's not allowed to set a clear text value to the property
- How To Get Log, Trace Files In OA Framework Pages And Concurrent Request Programs (文档 ID 290614.1)
- [Yii Framework] How to run cron job (or use command) in the server with yii framework
- How to set the DefaultButton in a Page Based on ASP.NET Master Page
- nrf51822 secure DFU by OTA: How to Set Password in the DFU zip File