Posts

Showing posts from May, 2014

Groovy expression for assigning DB Sequence value to a Key attribute

Image
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 :)   

How to hide the search operator from Query Panel

Image
Query Panel: How to hide the search operator from Query Panel : 1) Open the VC defined in VO object and go to UI hints tab and select show operator as never.   2) Or We can add CompOper tag in VO as below, 3) if we want to remove selected operator from the list then add the CompOper tag for every operator.      Please refer this link for more information  CompOper                 

Programmetic View Object in ADF

Image
Sometime we need to call Stored Procedure or Stored function in ADF application. Programmetic View objects are used for this. In this blog I will explain how to use Programmetic VO to call the Strored procedure and function. We need to override following methods of the ViewImpl class executeQueryForCollection() hasNextForCollection() createRowFromResultSet() releaseUserDataForCollection() Below are the detailed steps create VO as below    2. add the needed atributes    3. Override the above mentioned methods in VOImpl Class    4. Make sure all the attributes in VO are updatable    5. Atleast one attribute should be key attribute    6. I have created Employee VO as below      Define the Stored Function in DB, CREATE OR REPLACE FUNCTION HR.FUNC_returnEmployee RETURN SYS_REFCURSOR AS REF_TEST   SYS_REFCURSOR; BEGIN OPEN REF_TEST FOR SELECT   employee_id,first_name,phone_number,salary FROM   employees; RETURN REF_TEST; END; Code of ViewObject