About Oracle TopLink and EclipseLink

9-6 Oracle Fusion Middleware Performance and Tuning Guide Table 9–2 EJB3.0 Entity Relationship Query Performance Options Tuning Parameter Description Performance Notes Batch Reading The eclipselink.batch hint supplies EclipseLink with batching information so subsequent queries of related objects can be optimized in batches instead of being retrieved one-by-one or in one large joined read. Batching is only allowed on queries that have a single object in their select clause.The query hint to configure this is eclipselink.batch. See Also: EclipseLink Users Guide section Using EclipseLink JPA Extensions - Batch at http:wiki.eclipse.orgUsing_ EclipseLink_JPA_Extensions_ ELUGBatch Default Value: Off Use for queries of tables with columns mappings to table data you need.You should only use either batch-reading or joining if you know that you are going to access all of the data; if you do not intend to access the relationships, then just let indirection defer their loading. Batch reading is more efficient than joining because it avoids reading duplicate data; therefore for best performance for queries where batch reading is supported, consider using batch reading instead of join reading. Join Join reading is a query optimization feature that enables a single query for a class to return the data to build the instances of that class and its related objects. Use this feature to improve query performance by reducing database access. By default, relationships are not join-read: each relationship is fetched separately when accessed if you are using lazy-loading, or as a separate database query if you are not using lazy-loading. You can specify the use of join in JPQL JOIN FETCH, or you can set it multi-level in a query hint, eclipselink.join-fetch. It also can be set in the mapping annotation JoinFetch. Joining is part of the JPA specification, whereas batch reading is not. And, joining works on queries that not work with batch reading. For example, joining works on queries with multiple objects in the select clause, queries with a single result, and for cursors and firstmax results, whereas batch reading does not. See Also: Using EclipseLink JPA Extensions - Join Fetch at http:wiki.eclipse.orgUsing_ EclipseLink_JPA_Extensions_ ELUGJoin_Fetch Default Value: Not Used Use for queries of tables with columns mappings to table data you need.You should only use either batch-reading or joining if you know that you are going to access all of the data; if you do not intend to access the relationships, then just let indirection defer their loading.For the best performance of selects, where batch reading is not supported, a join is recommended Oracle TopLink EclipseLink JPA Performance Tuning 9-7

9.3 Cache Configuration Tuning

This section describes tuning the default internal cache that is provided by EclipseLink. Oracle ToplinkEclipseLink can also be integrated with Oracle Coherence. For information on configuring and tuning an EclipseLink Entity Cache using Oracle Coherence, see Section 9.4, Coherence Integration . The default settings for EJB3.0JPA used with the EclipseLink persistence manager and cache are no locking, no cache refresh, and cache-usage DoNotCheckCache. To ensure that your application uses the cache and does not read stale data from the cache when you do not have exclusive access, you must configure these and other isolation related settings appropriately. Table 9–3 shows the cache configuration options. Lazy loading Without lazy loading on, when EclipseLink retrieves a persistent object, it retrieves all of the dependent objects to which it refers. When you configure lazy reading also known as indirection, lazy loading, or just-in-time reading for an attribute mapped with a relationship mapping, EclipseLink uses an indirection object as a place holder for the referenced object. EclipseLink defers reading the dependent object until you access that specific attribute. This can result in a significant performance improvement, especially if the application is interested only in the contents of the retrieved object, rather than the objects to which it is related. See Also: What You May Need to Know About EclipseLink JPA Lazy Loading at http:wiki.eclipse.orgUsing_ EclipseLink_JPA_Extensions_ ELUGWhat_You_May_Need_to_Know_ About_EclipseL Default Value: On for collection mapping ToMany mappings, OneToMany, ManyToMany Default Value: Off for reference ToOne mappings, OneToOne, ManyToOne Note that setting lazy loading On for OneToOne, ManyToOne requires weaving, which is On by default for Java Java EE. Use lazy loading for all mappings. Using lazy loading and querying the referenced objects using batch reading or Join is more efficient than Eager loading. Note: By default, EclipseLink assumes that your application has exclusive access to the data it is using that is, there are no external, non-EclipseLink, applications modifying the data. If your application does not have exclusive access to the data, then you must change some of the defaults from Table 9–3 . Table 9–2 Cont. EJB3.0 Entity Relationship Query Performance Options Tuning Parameter Description Performance Notes