From hibernate-commits at lists.jboss.org Wed Nov 4 17:28:47 2009
Content-Type: multipart/mixed; boundary="===============7220653749206412012=="
MIME-Version: 1.0
From: hibernate-commits at lists.jboss.org
To: hibernate-commits at lists.jboss.org
Subject: [hibernate-commits] Hibernate SVN: r17915 -
core/trunk/documentation/manual/src/main/docbook/en-US/content.
Date: Wed, 04 Nov 2009 17:28:47 -0500
Message-ID: <200911042228.nA4MSlW8025517@svn01.web.mwc.hst.phx2.redhat.com>
--===============7220653749206412012==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: steve.ebersole(a)jboss.com
Date: 2009-11-04 17:28:47 -0500 (Wed, 04 Nov 2009)
New Revision: 17915
Modified:
core/trunk/documentation/manual/src/main/docbook/en-US/content/performan=
ce.xml
Log:
HHH-4006 - Document fetch profiles
Modified: core/trunk/documentation/manual/src/main/docbook/en-US/content/pe=
rformance.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/trunk/documentation/manual/src/main/docbook/en-US/content/performa=
nce.xml 2009-11-04 21:21:36 UTC (rev 17914)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/content/performa=
nce.xml 2009-11-04 22:28:47 UTC (rev 17915)
@@ -589,7 +589,76 @@
=
- =
+
+
+ Fetch profiles
+
+
+ Another way to affect the fetching strategy for loading as=
sociated objects is through something
+ called a fetch profile, which is a named configuration ass=
ociated with the
+ org.hibernate.SessionFactory but enabled, by name, on the
+ org.hibernate.Session. Onc=
e enabled on a
+ org.hibernate.Session, the =
fetch profile wull be in affect for
+ that org.hibernate.Session =
until it is explicitly disabled.
+
+
+ So what does that mean? Well lets explain that by way of =
an example. Say we have
+ the following mappings:
+
+
+
+ ...
+
+
+
+
+
+
+ ...
+
+]]>
+
+ Now normally when you get a reference to a particular cust=
omer, that customer's set of
+ orders will be lazy meaning we will not yet have loaded th=
ose orders from the database.
+ Normally this is a good thing. Now lets say that you have=
a certain use case where
+ it is more efficient to load the customer and their orders=
together. One way certainly is
+ to use "dynamic fetching" strategies via an HQL or criteri=
a queries. But another option is
+ to use a fetch profile to achieve that. Just add the foll=
owing to your mapping:
+
+
+ ...
+
+
+
+]]>
+
+ or even:
+
+
+
+ ...
+
+
+
+
+ ...
+]]>
+
+ Now the following code will actually load both the custome=
r and their orders:
+
+
+
+ Currently only join style fetch profiles are supported, bu=
t they plan is to support additional
+ styles. See HHH-3414
+ for details.
+
+
+
Using lazy property fetching
=
@@ -653,7 +722,6 @@
=
-
=
--===============7220653749206412012==--