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:
A doctor has an assistant.
A doctor has multiple patients.
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
It's important to note that relationship caching is not supported for many-to-many relationships. This is obviously because it can lead to deadlocks.