Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2) Part No. B15505-01 |
|
![]() Previous |
![]() Next |
The Oracle database allows you to perform SQL using an inner or outer join. Using a join is more efficient. These are described in the database manuals. However, the definitions from these manuals are as follows:�
Inner join: An inner join (sometimes called a "simple join") is a join of two or more tables that returns only those rows that satisfy the join condition.
An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and also returns some or all of those rows from one table for which no rows from the other satisfy the join condition.�
For more information on inner and outer joins, see the Oracle database manuals. �
Inside OC4J, if you have specified a one-to-one relationship between two entity beans, you automatically receive an outer join when retrieving data involving this relationship. Previously, OC4J would issue two SQL queries for each side of the relationship. Using the join improves performance by only issuing a single query. �
You can change to using an inner join by modifying the one-to-one-join attribute on the relationship field to inner, as follows:�
<cmr-field-mapping name="inventory" one-to-one-join="inner">
When the one-to-one mapping is unidirectional, place the one-to-one-join attribute on the origination of the relationship. When the relationship is bi-directional, specify the one-to-one-join attribute on both sides of the relationship.�