Oracle ADF view links are business components that define a relationship between two Oracle ADF view object definitions (the "source" and "destination" view objects) based on sets of view attributes (the "source" and "destination" attributes) from each. These can range from simple one-to-many relationships to complex many-to-many relationships. This allows you to easily create master/detail relationships between data controls in the client. For example, creating a view link between view objects will allow you to create relationships between:
Because view objects are data model components, you should consider your client's data needs when defining them. Decide which controls will need to be related, and which view objects will manage them.
To define a view link, see Representing Relationships Between Query Results.
Often, it is important to distinguish between the following:
You create a view link definition using JDeveloper's tools, based on two view object definitions. Instances of that view link can then be used to relate view object instances in application module definitions. For more information, see the related topics list.
A view link definition relates two view object definitions. In the vast
majority of cases, the view object definitions will contain SQL queries
that access a database, and the view link definition will relate those
queries using a parametrized WHERE
clause, which is
appended to the destination view object's query and resolved using the
values of source attributes.
For example, suppose you had the following view object definitions:
CustomersView
, containing the querySELECT *
FROM CUSTOMERS
OrdersView
, containing the querySELECT * FROM
ORDERS
You could create a view link, CustOrdLink
, with
CustomersView
's CustomerId
attribute as its
source attribute
WHERE
clause
WHERE :1 = ORDERS.CUSTOMER_ID
You could then use CustOrdLink
conjunction with a row from
CustomersView
(for example, the row for Customer 101) and all of
OrdersView
to return the rows from the query
SELECT * FROM ORDERS
WHERE 101 = ORDERS.CUSTOMER_ID
JDeveloper will create the parametrized query for you based on the
attributes you select. If you do not change this query, you can make the
view link bidirectional. This will switch the roles of the source and
destination attributes. For example, if you make CustOrdLink
bidirectional, you can use it in conjunction with a row from OrdersView
(for example, a row for an order placed by Customer 101) and all of
CustomersView to return the rows from the query
SELECT * FROM CUSTOMERS
WHERE CUSTOMERS.CUSTOMER_ID = 101
If two view object definitions each contain at least one entity object usage, and there is an association between the entity object definitions used, you can create a view link definition based on the association.
For example, suppose the following is true about CustomersView
and OrdersView
:
CustomersView
contains a usage of the entity object
Customers
OrdersView
contains a usage of the entity object
Orders
CustOrdAssoc
, between
Customers
and Orders
In this case, you can base CustOrdLink
on CustOrdAssoc
, rather than specifying the source and destination attributes yourself.
This is particularly useful if you want to create a many-to-many view link. For example, suppose you had the following business components:
Items
Warehouses
ItemsView
, containing a usage of
Items
WarehousesView
, containing a usage of
Warehouses
ItemWarehouseAssoc
between
Items
and Warehouses
You could create a view link, ItemsWarehouseLink, based on ItemsWarehouseAssoc. This view link would allow you to retrieve all warehouses in which a specific item was stored and (if bidirectional) all items stored by a specific warehouse. For more information, see the related topics list.
About Business Components
About the Business Components Framework
About View Object and View Link Instances
Creating a Many-to-Many View Link
About Oracle
ADF View Objects
About
View Object Attributes
About Oracle ADF
Application Modules
About Oracle ADF
Associations
Copyright © 1997, 2004, Oracle. All rights reserved.