In a custom page, i have created an EO based VO which has a primary key called : header_id which is initialized through a sequence in EOimpl -create method.
i have initialized the VO in PR. I open the page and close without submitting or committing the records from that page. Next time i submit the records from that page. But the sequence is skipping a value and assigns a new value.
This makes skipping in order of header_id.. How to control this type of skipping as our client wants to get the order without skipping any number.
Anybody met this issue ? Please help me..It is very urgent requirement.
First of all check your sequence in SQL developer and confirm if the NEXTVAL increases sequence by 1 or 2. After you are confirmed that it increased by 1 only, then there must be a case that your sequence is being invoked twice.
So you can have your create method invocation in the AM called only on specific conditions so that its not called by itself. Also ensure if the Id is set already, it should not be overwritten by updated value. Hope this gives you clues. Not sharing code snippet since it kills the joy of learning. :)
Check the cache size and increment by values of the associated sequence. Your value is incremented based on the sequence setups. Additionally for OM, I believe this is set up in Document Category/Assignments, so please check that setup as well.
it is not an issue with sequence, issue where and how to use the sequence. While opening the page or form which initializes VO in PR method. In EOimpl i have used the sequence in create method. So it is initialized as 1 and the cache is stored 1 as current value. If any error in page submission also the sequence cache remains in its current value. Next time i submit the form without error so now the sequence stores the value as 2. This is the issue , because first time i didnt submit the form just i open and close. Second time i have submitted without error. so my table skips value 1 and starts with 2.
If i initialize the sequence during commit method, this skip wont occur. But i need to initialize in PR itself.
Has anybody met this issue?
If the sequence is already derived (using nextval or similar methods), you cannot revert back unless you modify sequence dictionary tables. Better approach is to set the sequence only when the processing is successful.