Friday, July 5, 2013

Customized Sequence

We need to create a sequence to fill the primary key of a payment orders table.
The sequence number composed of :  
(the first two digits of the current year - dept id - serial )
Ex : 
      129010001
      139010001
      139010002
      135500001 
      135500002
 
Steps to accomplish the task :
  1. Create a PL/SQL function that deals with creating sequences
  2. Inside payment EO , Call PL/SQL function from doDml method 
  3. Pass the arguments .
  4. Get the result and assign it to the primary key or the target attribute
CallableStatement cs=
         getDBTransaction().createCallableStatement ("begin ? := PAY_ORDER_SEQ(?,?) ; end;", 0);

 PL/SQL function




Wednesday, July 3, 2013

Entity Object can't fetch PK for a view or Synonym


If we try to create an Entity Object (EO) based on a View or Synonym, we should add a Primary Key to EO manually , the reason is ADF Framework can't get the PK by itself .
by adding PK manually , you  avoid adding rowid column for your EO by ADF Framework .

(you can find another issue based on the same subject here:Entity Object based on Synonym issue )

an example : without PK



 



with PK:


finally , If you use Entity Object option instead of  ADF Business Component, you will be asked to add the primary key to a view/Synonym