Groovy expression for assigning DB Sequence value to a Key attribute

In DB table we have primary key column and primary key is generated by Sequence. There are couple of way to assign the value to primary key attribute in ADF.

1) User Groove experssion: Add groove experssion into Entity key attribute and set value field,
  
  (new oracle.jbo.server.SequenceImpl("<Sequence Name>",adf.object.getDBTransaction())).getSequenceNumber()



2)  Generate Entity object class for entity object as shown in figure below figure
   
     


 
Override the doDML method as below,
 
 
    protected void doDML(int operation, TransactionEvent e) {
        if(operation==DML_INSERT)
           this.setFileid(( new SequenceImpl("Sequence Name",getDBTransaction  ()).getSequenceNumber()));
        super.doDML(operation, e);
    }
 
Or Override the Create method of entityImpl class ...
 
Enjoy :)
  

Comments

Popular posts from this blog

React JS

WaterMark behavior in ADF

WebLogic Application Deployment & Shared Library