06 March 2015

ADF : Use Database Sequence in Entity Object

ADF Entity Object : How to use database sequence to populate EO attribute


If there is a requirement to use database sequence to populate an attribute of  ADF entity object, do the following:

1. Select the attribute where you want to use a sequence from attributes tab of an entity object
2. In details pane below, go to default value section
3. select "expression" radio button (one of three radio buttons - Literal, Expression and SQL)
4. add following groovy expression in the box provided below radio button

(new oracle.jbo.server.SequenceImpl("YOUR_SEQUENCE_NAME", adf.object.getDBTransaction())).getSequenceNumber()

5. Make sure that the sequence is available in the database you are connecting.
6. Save details and you are done, test your EO from Application Module tester or from the page.

No comments:

Post a Comment