1> What are View links?
Ans> View link creates a join between two views when we want to have parent child relationship between two views. In another way they are used when we want to
create master detail relationship between 2 view objects.
For eg : creating a view link between view objects will allow you to create relationships between:
A dropdown list for selecting a customer and a table displaying that customer's orders
The nodes in a tree control and their respective children
An HTML page containing two frames: one that allows the user to browse for items and the other that lists the wherehouses in which the selected item is stored
2> Explain View links with example of query
Ans > 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 query
SELECT * FROM CUSTOMERS
OrdersView, containing the query
SELECT * FROM ORDERS
You could create a view link, CustOrdLink, with
CustomersView's CustomerId attribute as its source attribute
The parametrized 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
3> What is association and compositions
Ans > There are two kinds of one-to-many relationships:
Cases where the children are not, strictly speaking, part of the parent. For example, a single department is related to many employees, but employees are independently existing things, not just parts of departments. A company could eliminate a department without necessarily eliminating its members.
Cases where the children are part of the parent. For example, a line item is strictly part of a purchase order. It makes no sense to delete an order without deleting all of its line items.
You can represent this difference by making associations of the second type into compositions. Making a one-to-many association into a composition has four effects:
Oracle ADF Business Components prevents you from creating a child entity object instance with no parent
Oracle ADF Business Components prevents you from deleting a parent entity object instance without deleting all of its children (the composition can be configured to delete the children, or to throw an exception when this is attempted)
Oracle ADF Business Components attempts to acquire a lock on a parent row whenever it acquires a lock on one of its children
Oracle ADF Business Components marks a parent entity object instance as needing validation whenever it marks one of its children as needing validation
Ans> View link creates a join between two views when we want to have parent child relationship between two views. In another way they are used when we want to
create master detail relationship between 2 view objects.
For eg : creating a view link between view objects will allow you to create relationships between:
A dropdown list for selecting a customer and a table displaying that customer's orders
The nodes in a tree control and their respective children
An HTML page containing two frames: one that allows the user to browse for items and the other that lists the wherehouses in which the selected item is stored
2> Explain View links with example of query
Ans > 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 query
SELECT * FROM CUSTOMERS
OrdersView, containing the query
SELECT * FROM ORDERS
You could create a view link, CustOrdLink, with
CustomersView's CustomerId attribute as its source attribute
The parametrized 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
3> What is association and compositions
Ans > There are two kinds of one-to-many relationships:
Cases where the children are not, strictly speaking, part of the parent. For example, a single department is related to many employees, but employees are independently existing things, not just parts of departments. A company could eliminate a department without necessarily eliminating its members.
Cases where the children are part of the parent. For example, a line item is strictly part of a purchase order. It makes no sense to delete an order without deleting all of its line items.
You can represent this difference by making associations of the second type into compositions. Making a one-to-many association into a composition has four effects:
Oracle ADF Business Components prevents you from creating a child entity object instance with no parent
Oracle ADF Business Components prevents you from deleting a parent entity object instance without deleting all of its children (the composition can be configured to delete the children, or to throw an exception when this is attempted)
Oracle ADF Business Components attempts to acquire a lock on a parent row whenever it acquires a lock on one of its children
Oracle ADF Business Components marks a parent entity object instance as needing validation whenever it marks one of its children as needing validation
No comments:
Post a Comment