Mapping Any Relational Schema to Any XML Schema

Oracle JCA Adapter for Database 9-49 ■ The is a default feature in the 10.1.2.0.2 release Disadvantages Batch attribute reading has the following disadvantages: ■ When using maxTransactionSize on polling receive or maxRows on invoke select to limit the number of rows loaded into memory at a time, these settings do not easily carry over to the batch attribute query. It is easier to work with a cursored result when there is only a single result set. Multiple cursors can be used with difficulty, if the original query has an order by clause. ■ TopLink can alter a SQL statement, only when it is in a format it can understand. If you use the hybrid SQL approach and set custom SQL for the root select, then TopLink will not be able to interpret that SQL to build the batch select. ■ The DISTINCT clause is used on the batch query, to avoid returning the same detail twice if two masters happen to both point to it. The DISTINCT clause cannot be used when returning LOBs in the resultset. Configuration Configuration is on a per 1-1 or 1-M mapping basis. By default, all such mappings since the 10.1.2.0.2 release have this property set. To configure, edit or_ mappings.xml outside JDeveloper and edit the batch-reading elements to true default or false.

9.4.1.3.3 Returning a Single Result Set TopLink Joined-Attribute Reading

The detail tables are outer-joined to the original SQL select statement, returning both master and detail in a single result set, as shown in the following example: SELECT DISTINCT t1.DIRECTOR, ..., t1.VIEWER_RATING, t0.CRITIC, ..., t0.TITLE FROM MOVIE_REVIEWS t0, MOVIES t1 WHERE t1.RATING = A AND t0.TITLE + = t1.TITLE This requires one query execution in total. Advantages The advantages include the following: ■ In case of using maxTransactionSize while polling, the benefits of dealing with a single cursor can be great. ■ When following the hybrid SQL route and entering custom SQL statements, you only have to deal with a single SQL statement, whereas TopLink normally uses a series of additional hidden SQL statements to bring in related rows. ■ read consistency: Enables you to read all related rows at the same time, and not at different instances in time for the different tables. ■ Performance can be ideal as only a single round trip to the database is required, whereas batch attribute reading requires one for each table queried. Disadvantages There are some drawbacks, however, namely the cost of returning duplicate data. For example, consider that you read the Master and Detail tables; Master has 100 columns in each row, and Detail has 2 columns in each row. Each row in the table, Master also, typically has 100 related Detail rows. With one query in each table, the result sets for the preceding example appears, as shown in the following example: