About Oracle ADF Business Components Cache Management

Oracle ADF Business Components uses a sophisticated caching system to improve performance and maintain consistent views of data. Understanding how the caching system works is important for understanding how your business components will behave at runtime.

Every view object instance controls its own cache, called its view cache. This cache holds a collection of view rows. When a view object retrieves data from the datasource, it creates a view row to represent that row of data and adds the instance to the view cache. Each view attribute of this view row is populated, but how it's populated depends on whether or not the view attribute is mapped to an entity attribute.

Populating View Attributes Not Mapped to Entity Attributes

If a view attribute is not mapped to an entity attribute, the view attribute is populated directly with the value from the datasource.

For example, consider a view object, CustomerOrdersView, with the SQL query

SELECT CUSTOMERS.CUSTOMER_ID, CUSTOMERS.CUST_FIRST_NAME,
  CUSTOMERS.CUST_LAST_NAME, Orders.ORDER_ID, Orders.ORDER_DATE,
  Orders.ORDER_TOTAL
FROM CUSTOMERS, ORDERS Orders
WHERE CUSTOMERS.CUSTOMER_ID = Orders.CUSTOMER_ID        

and with view attributes:

Suppose that OrderId, OrderDate, and OrderTotal are not mapped to any entity attributes.

Now, suppose an instance of CustomersOrdersView, MyCustomersAndOrders, executes its query. The first row returned by the query is

CUSTOMER_ID CUST_FIRST_NAME CUST_LAST_NAME ORDER_ID ORDER_DATE ORDER_TOTAL
501 John Doe 1137 01-AUG-03 573

Then the OrderId, OrderDate, and OrderTotal view attributes for the first view row added to the view cache will be directly populated with these values.

MyCustomersAndOrdersCache, a single view row.

 

Populating View Attributes Mapped to Entity Attributes

If a view attribute is mapped to an entity attribute, the view object instance follows this procedure:

  1. The view object finds the entity object usage containing the entity attribute.
  2. The view object checks by primary key, to see if the appropriate entity object instance has already been created. If not, it creates the entity object instance and populates the mapped entity object attribute with the value from the datasource. The entity object instance is added to another cache, the entity cache.
  3. The view object attribute is populated with a pointer to the entity object attribute.

For example, consider the CustomerOrdersView view object definition mentioned above. Suppose the view object attributes CustomerId , CustFirstName, and CustLastName are mapped to entity object attributes with the same name in an entity object called Customers. When the first view row of the MyCustomersAndOrders view object instance is created, it will be populated with pointers to a row in Customers' entity cache:

Two caches are populated with pointers.

The Impact of the Entity Cache

Using the entity cache allows you to do the following:

If you do not need any of these advantages, however, you may want to eliminate the entity cache, because creating and storing the pointers adds a small amount of overhead. For more information, see the related topics list.

Caches and Application Modules

Each application module instance has an entirely separate set of caches. For this reason, it is very important that you know how to tune Oracle ADF Business Components so that it will scale for large numbers of application module instances, if you expect to have a large number of simultaneous users. For more information, see the related topics list.


Introducing Oracle ADF Business Components
About Oracle ADF View Objects
About View Object Attributes
About Oracle ADF Entity Objects
About Entity Object Attributes
About View Object and View Link Instances
About Oracle ADF Application Modules
Bypassing Entity Caching
Bypassing View Caching
Scaling Multiple Transactions

 

 

 

Copyright © 1997, 2004, Oracle. All rights reserved.