Oct 12, 2012

Association and Association accessor

Relationships between entity object definitions are handled by Oracle ADF associations, which define a relationship between two Oracle ADF entity object definitions based on sets of entity attributes from each.  
Associations map to relationships between single objects in the data source. In the vast majority of cases, these are relationships among tables, views, synonyms, and snapshots in a database.
When the data source is a database, associations often map to foreign key relationships between tables in the database. Although you do not need to actually create a foreign key constraint between tables to create a one-to-one or one-to-many association between the corresponding entity objects, there should at least be an appropriate logical relationship between the tables

1.)Accessor Attributes:-

When you create an association between two entity object definitions, you can elect to add accessor attributes to the source entity object definition, the destination entity object definition, or both.and these accessor attributes function much like other attributes.
Their names can be passed as arguments to EntityImpl.getAttribute(). 
If you generate an entity object class, a getter method for the accessor attributes will be included in the class.
The value of returned by the call to getAttribute() or the getter method depends on the cardinality of the association.

2.)Cardinality:-

Associations can range from simple one-to-many relationships based on foreign keys to complex many-to-many relationships. 
Associations can represent :-
  1. The one-to-many relationship
  2.  The one-to-one relationship
  3. The many-to-many relationship.
The one-to-many and one-to-one relationship work much like foreign key relationships ,i.e., a set of attributes of the source entity object are matched with a set of attributes of the destination entity object definition.
Many-to-many associations are effectively the same as two one-to-many relationships involving the source and destination entity object definitions and a third entity object definition, the intersection.
There are some steps of creating  association:-
 Right click on model and select New option from context menu and select ADF Business Components and then Association option and press ok.
Give the package and Association name and press next.
Now select cardinality and Entity attribute of source and destination entity object and press Add button.
And press next botton.
Now press next 

Press next and Finish.



No comments:

Post a Comment