Relationship Caching in EJBs

Caching of Entity beans and their related Entity beans improves performance by reducing the number of JOIN queries that have to be executed. In our earlier example, we had three types of relationships:

  • One-to-one— A doctor has an assistant.

  • One-to-many— A doctor has multiple patients.

  • Many-to-many— A doctor works at multiple hospitals and each hospital has multiple doctors.

The <relationship-caching> tag of weblogic-cmp-rdbms.xml is used to specify caching of these relationships. Listing 22.17 is an excerpt from a weblogic-cmp-rdbms.xml file showing the caching of relationships.

Listing 22.17. weblogic-cmp-rdbms Excerpt
 <relationship-caching> <caching-name>cacheMoreBeans</caching-name> <caching-element> <cmr-field>assistantName</cmr-field> ...

Get BEA WebLogic Server™ 8.1 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.