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


Saturday, May 4, 2013

Friday, May 3, 2013

Friday, April 26, 2013

Task Flow And Switcher Example

The next example show how to switch between two fragments in the same task flow by using the switcher .

Use Case : The user can explore the hierarchy of departments and explore the hierarchy of employees by selecting from the menu in the left corner of the screen 

The hierarchy of departments

The hierarchy of employees

One of the solutions that can be used is the use of dynamic region, but in my case I will use a different technique which consists of a single task flow with 2 fragments and switcher

Implementation steps :
  1. create a task flow (fragment)
  2. create a switcher and 2 fragments , one for  hierarchy of departments and one for hierarchy of employees
  3. define cases for the switcher
  4. add the task flow to a consumer page as a region 
  5. create menu and add setPropertyListener to menu items
  6. add partial trigger to the region 
  7. change Refresh' property for the task flow to "if needed"

Create the task flow with 2 page fragments and add the navigation cases 

create the region for the hierarchy of departments 

create the region for the hierarchy of employees 

Define a parameter in  the parameters section 

Define the cases of the switcher  :
if the value of choiceParam == 'dept' then go to hierarchy of departments
if the
value of choiceParam == 'emp' then go to hierarchy of employees

Add the task flow as a region to a consumer page
create a menu model
Add partial trigger for the region 

Add SetPropertyListener to menu items

In the consumer page :
  • go to the page definition
  • pass the value of the menu item to the task flow
  • change refresh ' property to "ifNeeded"

Monday, April 15, 2013

Entity Object based on Synonym issue

We have HR and Finance Database , in the schema of Hr we need to create an Entity Object Based on Synonym in Financial database.
when running wizard to create ADBC , we can't see any Eo or Vo !
I will explain how to reproduce the problem and how to solve it

The Design of the Database :
  • Ben_View is DB View in Finance
  • HR have the privilege to select data from Ben_View

Now start ADFBC wizard

Choose connection

choose Synonym only

Create Entity Object

Create View Object

Create Application Module

The result is ....... !!!
No Entity Object or View Object  , just Application module !

I have tried repeating the above steps with another synonyms and the result was good and normal !

ok , now let's look at Ben_View , Ben_View composed of two query and this is the difference between it and other synonyms 

the solution is very easy , we need to add primary key for Ben_View when creating EO.
i will create EO and add PK to it 

Now we can see EO inside the project