Author: epbernard
Date: 2006-11-30 17:12:54 -0500 (Thu, 30 Nov 2006)
New Revision: 10903
Modified:
branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml
Log:
ANN-430 refine donc on LAZY/EAGER
Modified: branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml
===================================================================
---
branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml 2006-11-30
21:54:27 UTC (rev 10902)
+++
branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml 2006-11-30
22:12:54 UTC (rev 10903)
@@ -1700,7 +1700,7 @@
more information on cascading and create/merge semantics.</para>
</sect3>
- <sect3>
+ <sect3 id="entity-mapping-association-fetching"
revision="1">
<title>Association fetching</title>
<para>You have the ability to either eagerly or lazily fetch
@@ -1708,11 +1708,20 @@
to <literal>FetchType.LAZY</literal> or
<literal>FetchType.EAGER</literal>.
<literal>EAGER</literal> will try
to use an outer join select to retrieve the associated object, while
- <literal>LAZY</literal> is the default and will only trigger a
select
- when the associated object is accessed for the first time. EJBQL also
- has a <literal>fetch</literal> keyword that allows you to override
- laziness when doing a particular query. This is very useful to improve
- performance and is decided on a use case to use case basis.</para>
+ <literal>LAZY</literal> will only trigger a select when the
associated
+ object is accessed for the first time. <literal>@OneToMany</literal>
+ and <literal>@ManyToMany</literal> associations are defaulted to
+ <literal>LAZY</literal> and <literal>@OneToOne</literal>
and
+ <literal>@ManyToOne</literal> are defaulted to
+ <literal>EAGER</literal>. For more information about static
fetching,
+ check <xref linkend="entity-hibspec-singleassoc-fetching" />.
</para>
+
+ <para>The recommanded approach is to use
<literal>LAZY</literal> onn
+ all static fetching definitions and override this choice dynamically
+ through JPA-QL. JPA-QL has a <literal>fetch</literal> keyword that
+ allows you to override laziness when doing a particular query. This is
+ very useful to improve performance and is decided on a use case to use
+ case basis.</para>
</sect3>
</sect2>
@@ -2693,7 +2702,8 @@
alter table Child add constraint FK_PARENT foreign key (parent_id) references
Parent</programlisting>
- <sect3>
+ <sect3 id="entity-hibspec-singleassoc-fetching"
+ label="Lazy options and fetching modes">
<title>Lazy options and fetching modes</title>
<para>EJB3 comes with the <literal>fetch</literal> option to
define
@@ -2806,7 +2816,7 @@
</listitem>
<listitem>
- the where clause, using @Where (applied on the target entity) or
@WhereJoinTable (applied on the association table)
+ the where clause, using @Where (applied on the target entity) or
@WhereJoinTable (applied on the association table)
</listitem>
<listitem>