ADF Database sequence using Groovy

We may have a database sequence that generate a primary key for the table. During the manual SQL insert query, we refer <SEQUENCE_NAME>.nextval to generate the next unique key for the primary key column. We could apply the same solution in ADF Entity object declarative using groovy expression.

To do this, open the entity object, Select Attribute that requires sequence value, Enable ‘Expression’, Select the expression icon and add the following expression as shown in the below image.

(new oracle.jbo.server.SequenceImpl(“<YOUR SEQUENCE NAME>”,adf.object.getDBTransaction())).getSequenceNumber()

In the above statement, replace <YOUR SEQUENCE NAME> with the database sequence name . For example if the sequence name is ‘SAMPLE_SEQ’ then following expression is valid.

(new oracle.jbo.server.SequenceImpl(“SAMPLE_SEQ”,adf.object.getDBTransaction())).getSequenceNumber()

090716_0340_ADFDBSequen1 ADF Database sequence using Groovy

Once it has been applied, Go the Source tab and change trustMode=”trusted” in TransientExpression for the attribute we enabled sequence just before. Default the value is unTrusted.


090716_0340_ADFDBSequen2 ADF Database sequence using Groovy



govindan ADF Database sequence using Groovy
Connect me


Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan ADF Database sequence using Groovy
Connect me
By | 2016-09-11T22:49:00+00:00 September 6th, 2016|Categories: ADF|Tags: , , , , |0 Comments
Like us on Facebook.