Header Ads

How to Create Associations in ADF

Alumni Association Association:-In today's scenario most of the applications are based on relational database table structure.In my previous post http://www.askqtp.com/2012/04/how-to-create-entity-object-in.html
I have told how to create Entity Object. If you look at very closely an EO is based on a single table.Now think about the scenario where there are two tables. Table one and table two and they are connected via foreign key relationship. So Entity Object one and Entity Object two must be connected via some link. This link is called Association.
If the foreign key relationship is there , JDeveloper can create the relationship automatically. This relationship is called Association.So in other words , an association is a relationship between source and destination Entity Objects.
Rules for Creating Association:
1. For two connecting EOs say Employee and department the Naming convention will be employeeDepartmentAssoc i.e the table1table2Assoc
2. Follow the camel case structure.
3.Suffix Assoc is written to clearly understand the association.
Case-1. If you have the  database ready the association is done by JDeveloper itself
Case-2: if you do not have the direct association between themselves  follow the below written steps.
Step-1: Click on File->New
image
Step 2: Select ADF Business Component from Business Tier from left pane.Select Association from right pane.click on OK.
image 
Step-3: if the database is not connected we might get a database connection prompt. Connect to the correct database and click on next.Provide Name of the association.Click on Next.
image
Step-4: Here we will be getting two Entity Objects. Select the source and destination Entity Object to create an association.
image
The other thing we need to take care is Cardinality.The different cardinalities imageare…
  1. One to many
  2. many to one
  3. many to many
During runtime programmatically application can determine for how many rows of the first table can access how many rows of the second table. 
Step-5: Expand the EOs to establish a connection between themselves. When done the below section will activate


image 
Source and Destination Attribute: Below of the settings , there is another attribute list called source and destination attribute. It will clearly tell you association setting with the degree of Cardinality.
Click on Next.
Step-6: This page talks about more details about Accessors. The option of exposing accessors in the optional Java class that backs an entity object.
image
These assessors will give freedom to traverse between themselves programmatically
Step-7: On the same page the last point is Composition Association . There are two types of associations..
Reference The association references a destination entity object
Contains The destination entity can be thought of as a logical subpart of the source
image
Enable that by clicking on the on/off switch.
Click on Next
Step-8: If we need to change query and add some more options , this is the page to fine tune and add query clause.
image
Click on Next.
Step-9: This is the summary page of what the association we have made.
image
Click finish to create association successfully.
Any point of time we can go back and change the wizard(code).
Step-10. Double click or expand your folder for the association.
image
This is how we can create an association through ADF via JDeveloper.
Photo credit : http://kingsway.dnn.appros.net






Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Windows Live Tags: Create,Associations,Association,scenario,database,Object,Table,relationship,JDeveloper,words,destination,Objects,Rules,Employee,department,convention,Suffix,Assoc,Case,steps,Step,Click,File,Select,Component,Tier,pane,connection,Connect,Provide,Name,Here,Expand,Source,Attribute,degree,talks,Accessors,option,Java,freedom,Composition,Reference,Enable,clause,code,Double,folder,Photo,assessors,references,options
WordPress Tags: Create,Associations,Association,scenario,database,Object,Table,relationship,JDeveloper,words,destination,Objects,Rules,Employee,department,convention,Suffix,Assoc,Case,steps,Step,Click,File,Select,Component,Tier,pane,connection,Connect,Provide,Name,Here,Expand,Source,Attribute,degree,talks,Accessors,option,Java,freedom,Composition,Reference,Enable,clause,code,Double,folder,Photo,assessors,references,options
Blogger Labels: Create,Associations,Association,scenario,database,Object,Table,relationship,JDeveloper,words,destination,Objects,Rules,Employee,department,convention,Suffix,Assoc,Case,steps,Step,Click,File,Select,Component,Tier,pane,connection,Connect,Provide,Name,Here,Expand,Source,Attribute,degree,talks,Accessors,option,Java,freedom,Composition,Reference,Enable,clause,code,Double,folder,Photo,assessors,references,options
Powered by Blogger.