10.12.2012 Views

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

■ The reference to the root purchase_order object<br />

Overview of Complex Object Retrieval<br />

■ One or more pairs of type and depth information for customer, purchase_<br />

order, or line_item<br />

An application prefetching a purchase order will very likely need access to the<br />

customer information for that purchase order. Using simple navigation, this would<br />

require two database server accesses to retrieve the two objects.<br />

Through complex object retrieval, customer can be prefetched when the<br />

application pins the purchase_order object. In this case, the complex object<br />

would consist of the purchase_order object and the customer object it<br />

references.<br />

In the previous example, if the application wanted to prefetch a purchase order and<br />

the related customer information, the application would specify the purchase_<br />

order object and indicate that customer should be followed to a depth level of<br />

one as follows:<br />

Ref poref;<br />

poref.setPrefetch("CUSTOMER",1);<br />

If the application wanted to prefetch a purchase order and all objects in the object<br />

graph it contains, the application would specify the purchase_order object and<br />

indicate that both customer and purchase_order should be followed to the<br />

maximum depth level possible as follows:<br />

Ref poref;<br />

poref.setPrefetch("CUSTOMER", OCCI_MAX_PREFETCH_DEPTH);<br />

poref.setPrefetch("PURCHASE_ORDER", OCCI_MAX_PREFETCH_DEPTH);<br />

where OCCI_MAX_PREFETCH_DEPTH specifies that all objects of the specified type<br />

reachable through references from the root object should be prefetched.<br />

If an application wanted to prefetch a purchase order and all the line items<br />

associated with it, the application would specify the purchase_order object and<br />

indicate that line_items should be followed to the maximum depth level possible<br />

as follows:<br />

Ref poref;<br />

poref.setPrefetch("LINE_ITEM", 1);<br />

Object Programming 3-21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!