Polymorphic VO is one of the interesting feature for ADF business components , you can define parent-child hierarchy in Entity objects and can use single VO on base EO to retrieve diff childs .
Steps :
1. Create Base EO like Persons EO
-Keep attrs relevent to Person and remove others
-Select the discriminator check box for person_type and give default as 'PERS'
2. Create SubTypes
- Create EmployeeEO and extends it from Persons EO
- add additional columns from Table [Salary]
- override discriminator column give default as 'Employee'
- Create CustomerEO and extends it from Persons EO
- add additional columns from Table [Credit Limit]
- override discriminator column give default as 'Cust'
3. Polymorphic VO
- Create VO based on base EO
- After selecting the base EO , select subtypes and select the other two EO's
Now the hierarchy is complete and you have Polymorphic VO that can represent diff EO types.
You will see following code in VO :
<AttrArray Name="EntityImports">
<Item Value="project1.EO.CustomerEO"/>
<Item Value="project1.EO.EmployeeEO"/>
</AttrArray>
This shows the types of entities it can refer to.
No comments:
Post a Comment