In this post i will show how we can create and use sequence in Oracle ADF by using Groovy expression. First create a sequence in your database then use the following code to implement it.
(new oracle.jbo.server.SequenceImpl(“PURCHASEREQ_SEQ”,adf.object.getDBTransaction())).getSequenceNumber()
(new oracle.jbo.server.SequenceImpl(“PURCHASEREQ_SEQ”,adf.object.getDBTransaction())).getSequenceNumber()
here PURCHASEREQ_SEQ is my sequence name that I have created in Database. See the below snapshot for clarification.
so this is really simple and easy way to implement sequence.
Comments
One response to “Create Sequence in Oracle ADF”
Hi,
Thanks for the post.
What if the user rollback and did not want to insert new record. Does the sequence number keep returns to its original value before user request.
Example:
Imagine user press (CreateInsert Button), newly records is showing to the user with the current sequence number (let's say it is 100). Now, what if the user rollback and cancel the operation. Dose the sequence stay on 100 as the current number or its start from 101 when the user want to add new record later