[hibernate-commits] Hibernate SVN: r11386 - trunk/Hibernate3/doc/reference/en/modules.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Apr 2 13:40:05 EDT 2007


Author: steve.ebersole at jboss.com
Date: 2007-04-02 13:40:05 -0400 (Mon, 02 Apr 2007)
New Revision: 11386

Modified:
   trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml
Log:
document enhanced id generators

Modified: trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml
===================================================================
--- trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml	2007-04-02 17:39:24 UTC (rev 11385)
+++ trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml	2007-04-02 17:40:05 UTC (rev 11386)
@@ -1,7 +1,7 @@
 <chapter id="mapping">
     <title>Basic O/R Mapping</title>
 
-    <sect1 id="mapping-declaration" revision="1">
+    <sect1 id="mapping-declaration" revision="2">
         <title>Mapping declaration</title>
 
         <para>
@@ -10,7 +10,7 @@
             Java-centric, meaning that mappings are constructed around persistent class
             declarations, not table declarations.
         </para>
-        
+
         <para>
             Note that, even though many Hibernate users choose to write the XML by hand,
             a number of tools exist to generate the mapping document, including XDoclet,
@@ -28,22 +28,22 @@
 
 <hibernate-mapping package="eg">
 
-        <class name="Cat" 
+        <class name="Cat"
             table="cats"
             discriminator-value="C">
-                
+
                 <id name="id">
                         <generator class="native"/>
                 </id>
 
-                <discriminator column="subclass" 
+                <discriminator column="subclass"
                      type="character"/>
 
                 <property name="weight"/>
 
                 <property name="birthdate"
-                    type="date" 
-                    not-null="true" 
+                    type="date"
+                    not-null="true"
                     update="false"/>
 
                 <property name="color"
@@ -52,7 +52,7 @@
                     update="false"/>
 
                 <property name="sex"
-                    not-null="true" 
+                    not-null="true"
                     update="false"/>
 
                 <property name="litterId"
@@ -73,7 +73,7 @@
                 <subclass name="DomesticCat"
                     discriminator-value="D">
 
-                        <property name="name" 
+                        <property name="name"
                             type="string"/>
 
                 </subclass>
@@ -87,9 +87,9 @@
 </hibernate-mapping>]]></programlisting>
 
         <para>
-             We will now discuss the content of the mapping document. We will only describe the 
-             document elements and attributes that are used by Hibernate at runtime. The mapping 
-             document also contains some extra optional attributes and elements that affect the 
+             We will now discuss the content of the mapping document. We will only describe the
+             document elements and attributes that are used by Hibernate at runtime. The mapping
+             document also contains some extra optional attributes and elements that affect the
              database schemas exported by the schema export tool. (For example the <literal>
              not-null</literal> attribute.)
         </para>
@@ -100,7 +100,7 @@
             <title>Doctype</title>
 
             <para>
-                All XML mappings should declare the doctype shown. The actual DTD may be found 
+                All XML mappings should declare the doctype shown. The actual DTD may be found
                 at the URL above, in the directory <literal>hibernate-x.x.x/src/org/hibernate
                 </literal> or in <literal>hibernate3.jar</literal>. Hibernate will always look for
                 the DTD in its classpath first. If you experience lookups of the DTD using an
@@ -165,16 +165,16 @@
             <title>hibernate-mapping</title>
 
             <para>
-                This element has several optional attributes. The <literal>schema</literal> and 
-                <literal>catalog</literal> attributes specify that tables referred to in this mapping 
-                belong to the named schema and/or catalog. If specified, tablenames will be qualified 
-                by the given schema and catalog names. If missing, tablenames will be unqualified. 
+                This element has several optional attributes. The <literal>schema</literal> and
+                <literal>catalog</literal> attributes specify that tables referred to in this mapping
+                belong to the named schema and/or catalog. If specified, tablenames will be qualified
+                by the given schema and catalog names. If missing, tablenames will be unqualified.
                 The <literal>default-cascade</literal> attribute specifies what cascade style
-                should be assumed for properties and collections which do not specify a 
+                should be assumed for properties and collections which do not specify a
                 <literal>cascade</literal> attribute. The <literal>auto-import</literal> attribute lets us
                 use unqualified class names in the query language, by default.
             </para>
- 
+
              <programlistingco>
                  <areaspec>
                      <area id="hm1" coords="2 55"/>
@@ -207,7 +207,7 @@
                      </callout>
                      <callout arearefs="hm3">
                          <para>
-                             <literal>default-cascade</literal> (optional - defaults to <literal>none</literal>): 
+                             <literal>default-cascade</literal> (optional - defaults to <literal>none</literal>):
                              A default cascade style.
                          </para>
                      </callout>
@@ -234,15 +234,15 @@
                      </callout>
                      <callout arearefs="hm7">
                          <para>
-                             <literal>package</literal> (optional): Specifies a package prefix to assume for 
+                             <literal>package</literal> (optional): Specifies a package prefix to assume for
                              unqualified class names in the mapping document.
                          </para>
                      </callout>
                  </calloutlist>
              </programlistingco>
-             
+
              <para>
-                 If you have two persistent classes with the same (unqualified) name, you should set 
+                 If you have two persistent classes with the same (unqualified) name, you should set
                  <literal>auto-import="false"</literal>. Hibernate will throw an exception if you attempt
                  to assign two classes to the same "imported" name.
              </para>
@@ -256,7 +256,7 @@
                  <literal>Dog.hbm.xml</literal>, or if using inheritance,
                  <literal>Animal.hbm.xml</literal>.
              </para>
- 
+
         </sect2>
 
         <sect2 id="mapping-declaration-class" revision="3">
@@ -265,7 +265,7 @@
             <para>
                 You may declare a persistent class using the <literal>class</literal> element:
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="class1" coords="2 55"/>
@@ -317,8 +317,8 @@
                 <calloutlist>
                     <callout arearefs="class1">
                         <para>
-                            <literal>name</literal> (optional): The fully qualified Java class name of the 
-                            persistent class (or interface). If this attribute is missing, it is assumed 
+                            <literal>name</literal> (optional): The fully qualified Java class name of the
+                            persistent class (or interface). If this attribute is missing, it is assumed
                             that the mapping is for a non-POJO entity.
                         </para>
                     </callout>
@@ -337,93 +337,93 @@
                     </callout>
                     <callout arearefs="class4">
                         <para>
-                            <literal>mutable</literal> (optional, defaults to <literal>true</literal>): Specifies 
+                            <literal>mutable</literal> (optional, defaults to <literal>true</literal>): Specifies
                             that instances of the class are (not) mutable.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class5">
                         <para>
                             <literal>schema</literal> (optional): Override the schema name specified by
                             the root <literal>&lt;hibernate-mapping&gt;</literal> element.
                         </para>
-                    </callout>                
+                    </callout>
                     <callout arearefs="class6">
                         <para>
                             <literal>catalog</literal> (optional): Override the catalog name specified by
                             the root <literal>&lt;hibernate-mapping&gt;</literal> element.
                         </para>
-                    </callout>                
+                    </callout>
                     <callout arearefs="class7">
                         <para>
                             <literal>proxy</literal> (optional): Specifies an interface to use for lazy
                             initializing proxies. You may specify the name of the class itself.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class8">
                         <para>
-                            <literal>dynamic-update</literal> (optional, defaults to <literal>false</literal>): 
-                            Specifies that <literal>UPDATE</literal> SQL should be generated at runtime and 
+                            <literal>dynamic-update</literal> (optional, defaults to <literal>false</literal>):
+                            Specifies that <literal>UPDATE</literal> SQL should be generated at runtime and
                             contain only those columns whose values have changed.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class9">
                         <para>
-                            <literal>dynamic-insert</literal> (optional, defaults to <literal>false</literal>): 
-                            Specifies that <literal>INSERT</literal> SQL should be generated at runtime and 
+                            <literal>dynamic-insert</literal> (optional, defaults to <literal>false</literal>):
+                            Specifies that <literal>INSERT</literal> SQL should be generated at runtime and
                             contain only the columns whose values are not null.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class10">
                         <para>
-                            <literal>select-before-update</literal> (optional, defaults to <literal>false</literal>): 
-                            Specifies that Hibernate should <emphasis>never</emphasis> perform an SQL <literal>UPDATE</literal> 
+                            <literal>select-before-update</literal> (optional, defaults to <literal>false</literal>):
+                            Specifies that Hibernate should <emphasis>never</emphasis> perform an SQL <literal>UPDATE</literal>
                             unless it is certain that an object is actually modified. In certain cases (actually, only
                             when a transient object has been associated with a new session using <literal>update()</literal>),
                             this means that Hibernate will perform an extra SQL <literal>SELECT</literal> to determine
                             if an <literal>UPDATE</literal> is actually required.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class11">
                         <para>
-                            <literal>polymorphism</literal> (optional, defaults to <literal>implicit</literal>): 
+                            <literal>polymorphism</literal> (optional, defaults to <literal>implicit</literal>):
                             Determines whether implicit or explicit query polymorphism is used.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class12">
                         <para>
-                            <literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</literal> 
+                            <literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</literal>
                             condition to be used when retrieving objects of this class
                         </para>
-                    </callout>                 
+                    </callout>
                     <callout arearefs="class13">
                         <para>
                             <literal>persister</literal> (optional): Specifies a custom <literal>ClassPersister</literal>.
                         </para>
-                    </callout>                 
+                    </callout>
                     <callout arearefs="class14">
                         <para>
-                            <literal>batch-size</literal> (optional, defaults to <literal>1</literal>) specify a "batch size" 
+                            <literal>batch-size</literal> (optional, defaults to <literal>1</literal>) specify a "batch size"
                             for fetching instances of this class by identifier.
                         </para>
-                    </callout>                 
+                    </callout>
                    <callout arearefs="class15">
                         <para>
-                            <literal>optimistic-lock</literal> (optional, defaults to <literal>version</literal>): 
+                            <literal>optimistic-lock</literal> (optional, defaults to <literal>version</literal>):
                             Determines the optimistic locking strategy.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class16">
                         <para>
-                            <literal>lazy</literal> (optional): Lazy fetching may be completely disabled by setting 
+                            <literal>lazy</literal> (optional): Lazy fetching may be completely disabled by setting
                             <literal>lazy="false"</literal>.
                         </para>
-                    </callout>    
+                    </callout>
                     <callout arearefs="class17">
                         <para>
-                            <literal>entity-name</literal> (optional, defaults to the class name): Hibernate3 
-                            allows a class to be mapped multiple times (to different tables, potentially), 
-                            and allows entity mappings that are represented by Maps or XML at the Java level. 
-                            In these cases, you should provide an explicit arbitrary name for the entity. See 
+                            <literal>entity-name</literal> (optional, defaults to the class name): Hibernate3
+                            allows a class to be mapped multiple times (to different tables, potentially),
+                            and allows entity mappings that are represented by Maps or XML at the Java level.
+                            In these cases, you should provide an explicit arbitrary name for the entity. See
                             <xref linkend="persistent-classes-dynamicmodels"/> and <xref linkend="xml"/>
                             for more information.
                         </para>
@@ -457,7 +457,7 @@
                     </callout>
                 </calloutlist>
             </programlistingco>
-           
+
             <para>
                 It is perfectly acceptable for the named persistent class to be an interface. You would then
                 declare implementing classes of that interface using the <literal>&lt;subclass&gt;</literal>
@@ -466,20 +466,20 @@
             </para>
 
             <para>
-                Immutable classes, <literal>mutable="false"</literal>, may not be updated or deleted by the 
+                Immutable classes, <literal>mutable="false"</literal>, may not be updated or deleted by the
                 application. This allows Hibernate to make some minor performance optimizations.
             </para>
-            
+
             <para>
                 The optional <literal>proxy</literal> attribute enables lazy initialization of persistent
-                instances of the class. Hibernate will initially return CGLIB proxies which implement 
-                the named interface. The actual persistent object will be loaded when a method of the 
+                instances of the class. Hibernate will initially return CGLIB proxies which implement
+                the named interface. The actual persistent object will be loaded when a method of the
                 proxy is invoked. See "Proxies for Lazy Initialization" below.
             </para>
-            
+
             <para><emphasis>Implicit</emphasis> polymorphism means that instances of the class will be returned
                 by a query that names any superclass or implemented interface or the class and that instances
-                of any subclass of the class will be returned by a query that names the class itself. 
+                of any subclass of the class will be returned by a query that names the class itself.
                 <emphasis>Explicit</emphasis> polymorphism means that class instances will be returned only
                 by queries that explicitly name that class and that queries that name the class will return
                 only instances of subclasses mapped inside this <literal>&lt;class&gt;</literal> declaration
@@ -488,32 +488,32 @@
                 Explicit polymorphism is useful when two different classes are mapped to the same table
                 (this allows a "lightweight" class that contains a subset of the table columns).
             </para>
-            
+
             <para>
                 The <literal>persister</literal> attribute lets you customize the persistence strategy used for
-                the class. You may, for example, specify your own subclass of 
+                the class. You may, for example, specify your own subclass of
                 <literal>org.hibernate.persister.EntityPersister</literal> or you might even provide a
-                completely new implementation of the interface 
+                completely new implementation of the interface
                 <literal>org.hibernate.persister.ClassPersister</literal> that implements persistence via,
                 for example, stored procedure calls, serialization to flat files or LDAP. See
                 <literal>org.hibernate.test.CustomPersister</literal> for a simple example (of "persistence"
                 to a <literal>Hashtable</literal>).
             </para>
-            
+
             <para>
                 Note that the <literal>dynamic-update</literal> and <literal>dynamic-insert</literal>
                 settings are not inherited by subclasses and so may also be specified on the
-                <literal>&lt;subclass&gt;</literal> or <literal>&lt;joined-subclass&gt;</literal> elements. 
-                These settings may increase performance in some cases, but might actually decrease 
+                <literal>&lt;subclass&gt;</literal> or <literal>&lt;joined-subclass&gt;</literal> elements.
+                These settings may increase performance in some cases, but might actually decrease
                 performance in others. Use judiciously.
             </para>
-            
+
             <para>
                 Use of <literal>select-before-update</literal> will usually decrease performance. It is very
                 useful to prevent a database update trigger being called unnecessarily if you reattach a
                 graph of detached instances to a <literal>Session</literal>.
             </para>
-            
+
             <para>
                 If you enable <literal>dynamic-update</literal>, you will have a choice of optimistic
                 locking strategies:
@@ -581,12 +581,12 @@
             <title>id</title>
 
             <para>
-                Mapped classes <emphasis>must</emphasis> declare the primary key column of the database 
-                table. Most classes will also have a JavaBeans-style property holding the unique identifier 
+                Mapped classes <emphasis>must</emphasis> declare the primary key column of the database
+                table. Most classes will also have a JavaBeans-style property holding the unique identifier
                 of an instance. The <literal>&lt;id&gt;</literal> element defines the mapping from that
                 property to the primary key column.
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="id1" coords="2 70"/>
@@ -624,12 +624,12 @@
                     </callout>
                     <callout arearefs="id4">
                         <para>
-                            <literal>unsaved-value</literal> (optional - defaults to a "sensible" value): 
+                            <literal>unsaved-value</literal> (optional - defaults to a "sensible" value):
                             An identifier property value that indicates that an instance is newly instantiated
                             (unsaved), distinguishing it from detached instances that were saved or loaded
                             in a previous session.
                         </para>
-                    </callout>            
+                    </callout>
                    <callout arearefs="id5">
                         <para>
                             <literal>access</literal> (optional - defaults to <literal>property</literal>): The
@@ -638,12 +638,12 @@
                     </callout>
                 </calloutlist>
             </programlistingco>
-            
+
             <para>
-                If the <literal>name</literal> attribute is missing, it is assumed that the class has no 
+                If the <literal>name</literal> attribute is missing, it is assumed that the class has no
                 identifier property.
             </para>
-            
+
             <para>
                 The <literal>unsaved-value</literal> attribute is almost never needed in Hibernate3.
             </para>
@@ -652,7 +652,7 @@
                 There is an alternative <literal>&lt;composite-id&gt;</literal> declaration to allow access to
                 legacy data with composite keys. We strongly discourage its use for anything else.
             </para>
-            
+
             <sect3 id="mapping-declaration-id-generator" revision="2">
                 <title>Generator</title>
 
@@ -715,7 +715,7 @@
                                 uses a hi/lo algorithm to efficiently generate identifiers of
                                 type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>,
                                 given a table and column (by default <literal>hibernate_unique_key</literal> and
-                                <literal>next_hi</literal> respectively) as a source of hi values. The hi/lo 
+                                <literal>next_hi</literal> respectively) as a source of hi values. The hi/lo
                                 algorithm generates identifiers that are unique only for a particular database.
                             </para>
                         </listitem>
@@ -804,7 +804,7 @@
 
                 </para>
             </sect3>
-            
+
             <sect3 id="mapping-declaration-id-hilo" revision="1">
                 <title>Hi/lo algorithm</title>
                 <para>
@@ -836,7 +836,7 @@
                     the <literal>hibernate.transaction.manager_lookup_class</literal>.
                 </para>
             </sect3>
-            
+
             <sect3 id="mapping-declaration-id-uuid">
                 <title>UUID algorithm</title>
                 <para>
@@ -866,7 +866,7 @@
                 <programlisting><![CDATA[<id name="id" type="long" column="person_id" unsaved-value="0">
         <generator class="identity"/>
 </id>]]></programlisting>
-            
+
                 <para>
                     For cross-platform development, the <literal>native</literal> strategy will
                     choose from the <literal>identity</literal>, <literal>sequence</literal> and
@@ -874,7 +874,7 @@
                     underlying database.
                 </para>
             </sect3>
-            
+
             <sect3 id="mapping-declaration-id-assigned">
                 <title>Assigned identifiers</title>
                 <para>
@@ -885,12 +885,12 @@
                     is a natural key instead of a surrogate key. This is the default behavior
                     if you do no specify a <literal>&lt;generator&gt;</literal> element.
                 </para>
-                
+
                 <para>
-                    Choosing the <literal>assigned</literal> generator makes Hibernate use 
+                    Choosing the <literal>assigned</literal> generator makes Hibernate use
                     <literal>unsaved-value="undefined"</literal>, forcing Hibernate to go to
                     the database to determine if an instance is transient or detached, unless
-                    there is a version or timestamp property, or you define 
+                    there is a version or timestamp property, or you define
                     <literal>Interceptor.isUnsaved()</literal>.
                 </para>
             </sect3>
@@ -908,16 +908,182 @@
 </id>]]></programlisting>
 
                 <para>
-                    In the above example, there is a unique valued property named 
+                    In the above example, there is a unique valued property named
                     <literal>socialSecurityNumber</literal> defined by the class, as a
                     natural key, and a surrogate key named <literal>person_id</literal>
                     whose value is generated by a trigger.
                 </para>
-                
+
             </sect3>
 
         </sect2>
 
+        <sect2 id="mapping-declaration-id-enhanced">
+            <title>Enhanced identifier generators</title>
+
+            <para>
+                Starting with release 3.2.3, there are 2 new generators which represent a re-thinking of 2 different
+                aspects of identifier generation.  The first aspect is database portability; the second is optimization
+                (not having to query the database for every request for a new identifier value).  These two new
+                generators are intended to take the place of some of the named generators described above (starting
+                in 3.3.x); however, they are included in the current releases and can be referenced by FQN.
+            </para>
+
+            <para>
+                The first of these new generators is <literal>org.hibernate.id.enhanced.SequenceStyleGenerator</literal>
+                which is intended firstly as a replacement for the <literal>sequence</literal> generator and secondly as
+                a better portability generator than <literal>native</literal> (because <literal>native</literal>
+                (generally) chooses between <literal>identity</literal> and <literal>sequence</literal> which have
+                largely different semantics which can cause subtle isssues in applications eyeing portability).
+                <literal>org.hibernate.id.enhanced.SequenceStyleGenerator</literal> however achieves portability in
+                a different manner.  It chooses between using a table or a sequence in the database to store its
+                incrementing values depending on the capabilities of the dialect being used.  The difference between this
+                and <literal>native</literal> is that table-based and sequence-based storage have the same exact
+                semantic (in fact sequences are exactly what Hibernate tries to emmulate with its table-based
+                generators).  This generator has a number of configuration parameters:
+                <itemizedlist spacing="compact">
+                    <listitem>
+                        <para>
+                            <literal>sequence_name</literal> (optional, defaults to <literal>hibernate_sequence</literal>):
+                            The name of the sequence (or table) to be used.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>initial_value</literal> (optional, defaults to <literal>1</literal>): The initial
+                            value to be retrieved from the sequence/table.  In sequence creation terms, this is analogous
+                            to the clause typical named "STARTS WITH".
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>increment_size</literal> (optional, defaults to <literal>1</literal>): The value by
+                            which subsequent calls to the sequence/table should differ.  In sequence creation terms, this
+                            is analogous to the clause typical named "INCREMENT BY".
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>force_table_use</literal> (optional, defaults to <literal>false</literal>): Should
+                            we force the use of a table as the backing structure even though the dialect might support
+                            sequence?
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>value_column</literal> (optional, defaults to <literal>next_val</literal>): Only
+                            relevant for table structures!  The name of the column on the table which is used to
+                            hold the value.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>optimizer</literal> (optional, defaults to <literal>none</literal>):
+                            See <xref linkend="mapping-declaration-id-enhanced-optimizers"/>
+                        </para>
+                    </listitem>
+                </itemizedlist>
+            </para>
+            <para>
+                The second of these new generators is <literal>org.hibernate.id.enhanced.TableGenerator</literal> which
+                is intended firstly as a replacement for the <literal>table</literal> generator (although it actually
+                functions much more like <literal>org.hibernate.id.MultipleHiLoPerTableGenerator</literal>) and secondly
+                as a re-implementation of <literal>org.hibernate.id.MultipleHiLoPerTableGenerator</literal> utilizing the
+                notion of pluggable optimiziers.  Essentially this generator defines a table capable of holding
+                a number of different increment values simultaneously by using multiple distinctly keyed rows.  This
+                generator has a number of configuration parameters:
+                <itemizedlist spacing="compact">
+                    <listitem>
+                        <para>
+                            <literal>table_name</literal> (optional, defaults to <literal>hibernate_sequences</literal>):
+                            The name of the table to be used.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>value_column_name</literal> (optional, defaults to <literal>next_val</literal>):
+                            The name of the column on the table which is used to hold the value.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>segment_column_name</literal> (optional, defaults to <literal>sequence_name</literal>):
+                            The name of the column on the table which is used to hold the "segement key".  This is the
+                            value which distinctly identifies which increment value to use.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>segment_value</literal> (optional, defaults to <literal>default</literal>):
+                            The "segment key" value for the segment from which we want to pull increment values for
+                            this generator.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>segment_value_length</literal> (optional, defaults to <literal>255</literal>):
+                            Used for schema generation; the column size to create this segment key column.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>initial_value</literal> (optional, defaults to <literal>1</literal>):
+                            The initial value to be retrieved from the table.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>increment_size</literal> (optional, defaults to <literal>1</literal>):
+                            The value by which subsequent calls to the table should differ.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>optimizer</literal> (optional, defaults to <literal></literal>):
+                            See <xref linkend="mapping-declaration-id-enhanced-optimizers"/>
+                        </para>
+                    </listitem>
+                </itemizedlist>
+            </para>
+        </sect2>
+
+        <sect2 id="mapping-declaration-id-enhanced-optimizers">
+            <title>Identifier generator optimization</title>
+            <para>
+                For identifier generators which store values in the database, it is inefficient for them to hit the
+                database on each and every call to generate a new identifier value.  Instead, you'd ideally want to
+                group a bunch of them in memory and only hit the database when you have exhausted your in-memory
+                value group.  This is the role of the pluggable optimizers.  Currently only the two enhanced generators
+                (<xref linkend="mapping-declaration-id-enhanced"/> support this notion.
+                <itemizedlist spacing="compact">
+                    <listitem>
+                        <para>
+                            <literal>none</literal> (generally this is the default if no optimizer was specified):  This
+                            says to not perform any optimizations, and hit the database each and every request.
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>hilo</literal>: applies a hi/lo algorithm around the database retrieved values.  The
+                            values from the database for this optimizer are expected to be sequential.  The values
+                            retrieved from the database structure for this optimizer indicates the "group number"; the
+                            <literal>increment_size</literal> is multiplied by that value in memory to define a group
+                            "hi value".
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <literal>pooled</literal>: like was discussed for <literal>hilo</literal>, this optimizers
+                            attempts to minimize the number of hits to the database.  Here, however, we simply store
+                            the starting value for the "next group" into the database structure rather than a sequential
+                            value in combination with an in-memory grouping algorithm.  <literal>increment_size</literal>
+                            here refers to the values coming from the database.
+                        </para>
+                    </listitem>
+                </itemizedlist>
+            </para>
+        </sect2>
+
         <sect2 id="mapping-declaration-compositeid" revision="3">
             <title>composite-id</title>
 
@@ -939,7 +1105,7 @@
                 accepts <literal>&lt;key-property&gt;</literal> property mappings and
                 <literal>&lt;key-many-to-one&gt;</literal> mappings as child elements.
             </para>
-            
+
             <programlisting><![CDATA[<composite-id>
         <key-property name="medicareNumber"/>
         <key-property name="dependent"/>
@@ -952,20 +1118,20 @@
             </para>
 
             <para>
-                Unfortunately, this approach to composite identifiers means that a persistent object 
-                is its own identifier. There is no convenient "handle" other than the object itself. 
-                You must instantiate an instance of the persistent class itself and populate its 
+                Unfortunately, this approach to composite identifiers means that a persistent object
+                is its own identifier. There is no convenient "handle" other than the object itself.
+                You must instantiate an instance of the persistent class itself and populate its
                 identifier properties before you can <literal>load()</literal> the persistent state
                 associated with a composite key. We call this approach an <emphasis>embedded</emphasis>
                 composite identifier, and discourage it for serious applications.
             </para>
-            
+
             <para>
                 A second approach is what we call a <emphasis>mapped</emphasis> composite identifier,
-                where the identifier properties named inside the <literal>&lt;composite-id&gt;</literal> 
+                where the identifier properties named inside the <literal>&lt;composite-id&gt;</literal>
                 element are duplicated on both the persistent class and a separate identifier class.
             </para>
-                
+
             <programlisting><![CDATA[<composite-id class="MedicareId" mapped="true">
         <key-property name="medicareNumber"/>
         <key-property name="dependent"/>
@@ -974,12 +1140,12 @@
             <para>
                 In this example, both the composite identifier class, <literal>MedicareId</literal>,
                 and the entity class itself have properties named <literal>medicareNumber</literal>
-                and <literal>dependent</literal>. The identifier class must override 
-                <literal>equals()</literal> and <literal>hashCode()</literal> and implement. 
+                and <literal>dependent</literal>. The identifier class must override
+                <literal>equals()</literal> and <literal>hashCode()</literal> and implement.
                 <literal>Serializable</literal>. The disadvantage of this approach is quite
                 obvious&mdash;code duplication.
             </para>
-            
+
             <para>
                 The following attributes are used to specify a mapped composite identifier:
             </para>
@@ -995,59 +1161,59 @@
                 </listitem>
                 <listitem>
                     <para>
-                        <literal>class</literal> (optional, but required for a mapped composite identifier): 
+                        <literal>class</literal> (optional, but required for a mapped composite identifier):
                         The class used as a composite identifier.
                     </para>
                 </listitem>
             </itemizedlist>
 
             <para>
-                We will describe a third, even more convenient approach where the composite identifier 
-                is implemented as a component class in <xref linkend="components-compositeid"/>. The 
+                We will describe a third, even more convenient approach where the composite identifier
+                is implemented as a component class in <xref linkend="components-compositeid"/>. The
                 attributes described below apply only to this alternative approach:
             </para>
 
             <itemizedlist spacing="compact">
                 <listitem>
                     <para>
-                        <literal>name</literal> (optional, required for this approach): A property of 
+                        <literal>name</literal> (optional, required for this approach): A property of
                         component type that holds the composite identifier (see chapter 9).
                     </para>
                 </listitem>
                 <listitem>
                     <para>
-                        <literal>access</literal> (optional - defaults to <literal>property</literal>): 
+                        <literal>access</literal> (optional - defaults to <literal>property</literal>):
                         The strategy Hibernate should use for accessing the property value.
                     </para>
                 </listitem>
                 <listitem>
                     <para>
-                        <literal>class</literal> (optional - defaults to the property type determined by 
+                        <literal>class</literal> (optional - defaults to the property type determined by
                         reflection): The component class used as a composite identifier (see next section).
                     </para>
                 </listitem>
             </itemizedlist>
-            
+
             <para>
                 This third approach, an <emphasis>identifier component</emphasis> is the one we recommend
                 for almost all applications.
             </para>
-            
+
         </sect2>
-        
+
         <sect2 id="mapping-declaration-discriminator" revision="3">
             <title>discriminator</title>
 
             <para>
-                The <literal>&lt;discriminator&gt;</literal> element is required for polymorphic persistence 
-                using the table-per-class-hierarchy mapping strategy and declares a discriminator column of the 
-                table. The discriminator column contains marker values that tell the persistence layer what 
-                subclass to instantiate for a particular row. A restricted set of types may be used: 
-                <literal>string</literal>, <literal>character</literal>, <literal>integer</literal>, 
-                <literal>byte</literal>, <literal>short</literal>, <literal>boolean</literal>, 
+                The <literal>&lt;discriminator&gt;</literal> element is required for polymorphic persistence
+                using the table-per-class-hierarchy mapping strategy and declares a discriminator column of the
+                table. The discriminator column contains marker values that tell the persistence layer what
+                subclass to instantiate for a particular row. A restricted set of types may be used:
+                <literal>string</literal>, <literal>character</literal>, <literal>integer</literal>,
+                <literal>byte</literal>, <literal>short</literal>, <literal>boolean</literal>,
                 <literal>yes_no</literal>, <literal>true_false</literal>.
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="discriminator1" coords="2 60"/>
@@ -1075,14 +1241,14 @@
                             <literal>type</literal> (optional - defaults to <literal>string</literal>) a
                             name that indicates the Hibernate type
                         </para>
-                    </callout>          
+                    </callout>
                     <callout arearefs="discriminator3">
                         <para>
-                            <literal>force</literal> (optional - defaults to <literal>false</literal>) 
-                            "force" Hibernate to specify allowed discriminator values even when retrieving 
+                            <literal>force</literal> (optional - defaults to <literal>false</literal>)
+                            "force" Hibernate to specify allowed discriminator values even when retrieving
                             all instances of the root class.
                         </para>
-                    </callout>          
+                    </callout>
                     <callout arearefs="discriminator4">
                         <para>
                             <literal>insert</literal> (optional - defaults to <literal>true</literal>)
@@ -1093,7 +1259,7 @@
                     </callout>
                     <callout arearefs="discriminator5">
                         <para>
-                            <literal>formula</literal> (optional) an arbitrary SQL expression that is 
+                            <literal>formula</literal> (optional) an arbitrary SQL expression that is
                             executed when a type has to be evaluated. Allows content-based discrimination.
                         </para>
                     </callout>
@@ -1105,7 +1271,7 @@
                 <literal>discriminator-value</literal> attribute of the <literal>&lt;class&gt;</literal> and
                 <literal>&lt;subclass&gt;</literal> elements.
             </para>
-            
+
             <para>
                 The <literal>force</literal> attribute is (only) useful if the table contains rows with
                 "extra" discriminator values that are not mapped to a persistent class. This will not
@@ -1125,13 +1291,13 @@
 
         <sect2 id="mapping-declaration-version" revision="4">
             <title>version (optional)</title>
-            
+
             <para>
                 The <literal>&lt;version&gt;</literal> element is optional and indicates that
                 the table contains versioned data. This is particularly useful if you plan to
                 use <emphasis>long transactions</emphasis> (see below).
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="version1" coords="2 70"/>
@@ -1158,7 +1324,7 @@
                             <literal>column</literal> (optional - defaults to the property name): The name
                             of the column holding the version number.
                         </para>
-                    </callout>          
+                    </callout>
                     <callout arearefs="version2">
                         <para>
                             <literal>name</literal>: The name of a property  of the persistent class.
@@ -1166,10 +1332,10 @@
                     </callout>
                     <callout arearefs="version3">
                         <para>
-                            <literal>type</literal> (optional - defaults to <literal>integer</literal>): 
+                            <literal>type</literal> (optional - defaults to <literal>integer</literal>):
                             The type of the version number.
                         </para>
-                    </callout>          
+                    </callout>
                    <callout arearefs="version4">
                         <para>
                             <literal>access</literal> (optional - defaults to <literal>property</literal>): The
@@ -1178,7 +1344,7 @@
                     </callout>
                    <callout arearefs="version5">
                         <para>
-                            <literal>unsaved-value</literal> (optional - defaults to <literal>undefined</literal>): 
+                            <literal>unsaved-value</literal> (optional - defaults to <literal>undefined</literal>):
                             A version property value that indicates that an instance is newly instantiated
                             (unsaved), distinguishing it from detached instances that were saved or loaded
                             in a previous session. (<literal>undefined</literal> specifies that the identifier
@@ -1202,32 +1368,32 @@
                     </callout>
                 </calloutlist>
             </programlistingco>
-            
+
             <para>
                 Version numbers may be of Hibernate type <literal>long</literal>, <literal>integer</literal>,
                 <literal>short</literal>, <literal>timestamp</literal> or <literal>calendar</literal>.
             </para>
-            
+
             <para>
                 A version or timestamp property should never be null for a detached instance, so
                 Hibernate will detact any instance with a null version or timestamp as transient,
                 no matter what other <literal>unsaved-value</literal> strategies are specified.
-                <emphasis>Declaring a nullable version or timestamp property is an easy way to avoid 
-                any problems with transitive reattachment in Hibernate, especially useful for people 
+                <emphasis>Declaring a nullable version or timestamp property is an easy way to avoid
+                any problems with transitive reattachment in Hibernate, especially useful for people
                 using assigned identifiers or composite keys!</emphasis>
             </para>
         </sect2>
-        
+
         <sect2 id="mapping-declaration-timestamp" revision="4" >
             <title>timestamp (optional)</title>
 
             <para>
-                The optional <literal>&lt;timestamp&gt;</literal> element indicates that the table contains 
+                The optional <literal>&lt;timestamp&gt;</literal> element indicates that the table contains
                 timestamped data. This is intended as an alternative to versioning. Timestamps are by nature
                 a less safe implementation of optimistic locking. However, sometimes the application might
                 use the timestamps in other ways.
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="timestamp1" coords="2 70"/>
@@ -1236,7 +1402,7 @@
                     <area id="timestamp4" coords="5 70" />
                     <area id="timestamp5" coords="6 70" />
                     <area id="timestamp6" coords="7 70" />
-                </areaspec>            
+                </areaspec>
                 <programlisting><![CDATA[<timestamp
         column="timestamp_column"
         name="propertyName"
@@ -1252,7 +1418,7 @@
                             <literal>column</literal> (optional - defaults to the property name): The name
                             of a column holding the timestamp.
                         </para>
-                    </callout>                   
+                    </callout>
                     <callout arearefs="timestamp2">
                         <para>
                             <literal>name</literal>: The name of a JavaBeans style property of
@@ -1268,7 +1434,7 @@
                     </callout>
                    <callout arearefs="timestamp4">
                         <para>
-                            <literal>unsaved-value</literal> (optional - defaults to <literal>null</literal>): 
+                            <literal>unsaved-value</literal> (optional - defaults to <literal>null</literal>):
                             A version property value that indicates that an instance is newly instantiated
                             (unsaved), distinguishing it from detached instances that were saved or loaded
                             in a previous session. (<literal>undefined</literal> specifies that the identifier
@@ -1296,9 +1462,9 @@
                     </callout>
                 </calloutlist>
             </programlistingco>
-            
+
             <para>
-                Note that <literal>&lt;timestamp&gt;</literal> is equivalent to 
+                Note that <literal>&lt;timestamp&gt;</literal> is equivalent to
                 <literal>&lt;version type="timestamp"&gt;</literal>.  And
                  <literal>&lt;timestamp source="db"&gt;</literal> is equivalent to
                 <literal>&lt;version type="dbtimestamp"&gt;</literal>
@@ -1310,10 +1476,10 @@
             <title>property</title>
 
             <para>
-                The <literal>&lt;property&gt;</literal> element declares a persistent, JavaBean style 
+                The <literal>&lt;property&gt;</literal> element declares a persistent, JavaBean style
                 property of the class.
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="property1" coords="2 70"/>
@@ -1330,7 +1496,7 @@
                     <area id="property10" coords="11 70"/>
                     <area id="property11" coords="12 70"/>
                     <area id="property12" coords="13 70"/>
-                </areaspec>            
+                </areaspec>
                 <programlisting><![CDATA[<property
         name="propertyName"
         column="column_name"
@@ -1357,11 +1523,11 @@
                             <literal>name</literal>: the name of the property, with an initial lowercase
                             letter.
                         </para>
-                    </callout>                   
+                    </callout>
                     <callout arearefs="property2">
                         <para>
                             <literal>column</literal> (optional - defaults to the property name): the name
-                            of the mapped database table column. This may also be specified by nested 
+                            of the mapped database table column. This may also be specified by nested
                             <literal>&lt;column&gt;</literal> element(s).
                         </para>
                     </callout>
@@ -1373,7 +1539,7 @@
                     <callout arearefs="property4-5">
                         <para>
                             <literal>update, insert</literal> (optional - defaults to <literal>true</literal>) :
-                            specifies that the mapped columns should be included in SQL <literal>UPDATE</literal> 
+                            specifies that the mapped columns should be included in SQL <literal>UPDATE</literal>
                             and/or <literal>INSERT</literal> statements. Setting both to <literal>false</literal>
                             allows a pure "derived" property whose value is initialized from some other
                             property that maps to the same colum(s) or by a trigger or other application.
@@ -1395,14 +1561,14 @@
                     <callout arearefs="property8">
                         <para>
                             <literal>lazy</literal> (optional - defaults to <literal>false</literal>): Specifies
-                            that this property should be fetched lazily when the instance variable is first 
+                            that this property should be fetched lazily when the instance variable is first
                             accessed (requires build-time bytecode instrumentation).
                         </para>
                     </callout>
                     <callout arearefs="property9">
                         <para>
                             <literal>unique</literal> (optional): Enable the DDL generation of a unique
-                            constraint for the columns. Also, allow this to be the target of 
+                            constraint for the columns. Also, allow this to be the target of
                             a <literal>property-ref</literal>.
                         </para>
                     </callout>
@@ -1414,9 +1580,9 @@
                     </callout>
                     <callout arearefs="property11">
                         <para>
-                            <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>): 
+                            <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>):
                             Specifies that updates to this property do or do not require acquisition of the
-                            optimistic lock. In other words, determines if a version increment should occur when 
+                            optimistic lock. In other words, determines if a version increment should occur when
                             this property is dirty.
                         </para>
                     </callout>
@@ -1468,7 +1634,7 @@
                 attribute. (For example, to distinguish between <literal>Hibernate.DATE</literal> and
                 <literal>Hibernate.TIMESTAMP</literal>, or to specify a custom type.)
             </para>
-            
+
             <para>
                 The <literal>access</literal> attribute lets you control how Hibernate will access
                 the property at runtime. By default, Hibernate will call the property get/set pair.
@@ -1559,11 +1725,11 @@
                     <callout arearefs="manytoone1">
                         <para>
                             <literal>name</literal>: The name of the property.
-                        </para>                    
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="manytoone2">
                         <para>
-                            <literal>column</literal> (optional): The name of the foreign key column. 
+                            <literal>column</literal> (optional): The name of the foreign key column.
                             This may also be specified by nested <literal>&lt;column&gt;</literal>
                             element(s).
                         </para>
@@ -1578,30 +1744,30 @@
                         <para>
                             <literal>cascade</literal> (optional): Specifies which operations should
                             be cascaded from the parent object to the associated object.
-                        </para>                    
+                        </para>
                     </callout>
                     <callout arearefs="manytoone5">
                         <para>
-                            <literal>fetch</literal> (optional - defaults to <literal>select</literal>): 
+                            <literal>fetch</literal> (optional - defaults to <literal>select</literal>):
                             Chooses between outer-join fetching or sequential select fetching.
-                        </para>                    
+                        </para>
                     </callout>
                     <callout arearefs="manytoone6-7">
                         <para>
-                            <literal>update, insert</literal> (optional - defaults to <literal>true</literal>) 
-                            specifies that the mapped columns should be included in SQL <literal>UPDATE</literal> 
+                            <literal>update, insert</literal> (optional - defaults to <literal>true</literal>)
+                            specifies that the mapped columns should be included in SQL <literal>UPDATE</literal>
                             and/or <literal>INSERT</literal> statements. Setting both to <literal>false</literal>
                             allows a pure "derived" association whose value is initialized from some other
                             property that maps to the same colum(s) or by a trigger or other application.
-                        </para>                    
+                        </para>
                     </callout>
                     <callout arearefs="manytoone8">
                         <para>
-                            <literal>property-ref</literal>: (optional) The name of a property of the associated 
+                            <literal>property-ref</literal>: (optional) The name of a property of the associated
                             class that is joined to this foreign key. If not specified, the primary key of
                             the associated class is used.
-                        </para>                
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="manytoone9">
                         <para>
                             <literal>access</literal> (optional - defaults to <literal>property</literal>): The
@@ -1611,8 +1777,8 @@
                     <callout arearefs="manytoone10">
                         <para>
                             <literal>unique</literal> (optional): Enable the DDL generation of a unique
-                            constraint for the foreign-key column. Also, allow this to be the target of 
-                            a <literal>property-ref</literal>. This makes the association multiplicity 
+                            constraint for the foreign-key column. Also, allow this to be the target of
+                            a <literal>property-ref</literal>. This makes the association multiplicity
                             effectively one to one.
                         </para>
                     </callout>
@@ -1624,33 +1790,33 @@
                     </callout>
                     <callout arearefs="manytoone12">
                         <para>
-                            <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>): 
+                            <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>):
                             Specifies that updates to this property do or do not require acquisition of the
-                            optimistic lock. In other words, dertermines if a version increment should occur when 
+                            optimistic lock. In other words, dertermines if a version increment should occur when
                             this property is dirty.
                         </para>
                     </callout>
                     <callout arearefs="manytoone13">
                         <para>
-                            <literal>lazy</literal> (optional - defaults to <literal>proxy</literal>): 
+                            <literal>lazy</literal> (optional - defaults to <literal>proxy</literal>):
                             By default, single point associations are proxied. <literal>lazy="no-proxy"</literal>
-                            specifies that the property should be fetched lazily when the instance variable 
-                            is first accessed (requires build-time bytecode instrumentation). 
+                            specifies that the property should be fetched lazily when the instance variable
+                            is first accessed (requires build-time bytecode instrumentation).
                             <literal>lazy="false"</literal> specifies that the association will always
                             be eagerly fetched.
                         </para>
                     </callout>
                     <callout arearefs="manytoone14">
                         <para>
-                            <literal>not-found</literal> (optional - defaults to <literal>exception</literal>): 
-                            Specifies how foreign keys that reference missing rows will be handled: 
+                            <literal>not-found</literal> (optional - defaults to <literal>exception</literal>):
+                            Specifies how foreign keys that reference missing rows will be handled:
                             <literal>ignore</literal> will treat a missing row as a null association.
                         </para>
                     </callout>
                     <callout arearefs="manytoone15">
                         <para>
                             <literal>entity-name</literal> (optional): The entity name of the associated class.
-                        </para>                   
+                        </para>
                     </callout>
                 </calloutlist>
                     <callout arearefs="manytoone16">
@@ -1664,64 +1830,64 @@
             <para>
                 Setting a value of the <literal>cascade</literal> attribute to any meaningful
                 value other than <literal>none</literal> will propagate certain operations to the
-                associated object. The meaningful values are the names of Hibernate's basic 
+                associated object. The meaningful values are the names of Hibernate's basic
                 operations, <literal>persist, merge, delete, save-update, evict, replicate, lock,
-                refresh</literal>, as well as the special values <literal>delete-orphan</literal> 
+                refresh</literal>, as well as the special values <literal>delete-orphan</literal>
                 and <literal>all</literal> and comma-separated combinations of operation
                 names, for example, <literal>cascade="persist,merge,evict"</literal> or
                 <literal>cascade="all,delete-orphan"</literal>. See <xref linkend="objectstate-transitive"/>
-                for a full explanation. Note that single valued associations (many-to-one and 
+                for a full explanation. Note that single valued associations (many-to-one and
                 one-to-one associations) do not support orphan delete.
             </para>
-            
+
             <para>
                 A typical <literal>many-to-one</literal> declaration looks as simple as this:
             </para>
 
             <programlisting><![CDATA[<many-to-one name="product" class="Product" column="PRODUCT_ID"/>]]></programlisting>
-            
+
             <para>
                 The <literal>property-ref</literal> attribute should only be used for mapping legacy
                 data where a foreign key refers to a unique key of the associated table other than
-                the primary key. This is an ugly relational model. For example, suppose the 
-                <literal>Product</literal> class had a unique serial number, that is not the primary 
+                the primary key. This is an ugly relational model. For example, suppose the
+                <literal>Product</literal> class had a unique serial number, that is not the primary
                 key. (The <literal>unique</literal> attribute controls Hibernate's DDL generation with
                 the SchemaExport tool.)
             </para>
-            
+
             <programlisting><![CDATA[<property name="serialNumber" unique="true" type="string" column="SERIAL_NUMBER"/>]]></programlisting>
-            
+
             <para>
                 Then the mapping for <literal>OrderItem</literal> might use:
             </para>
-            
+
             <programlisting><![CDATA[<many-to-one name="product" property-ref="serialNumber" column="PRODUCT_SERIAL_NUMBER"/>]]></programlisting>
-            
+
             <para>
                 This is certainly not encouraged, however.
             </para>
-            
+
             <para>
                 If the referenced unique key comprises multiple properties of the associated entity, you should
                 map the referenced properties inside a named <literal>&lt;properties&gt;</literal> element.
             </para>
-            
+
             <para>
             	If the referenced unique key is the property of a component, you may specify a property path:
             </para>
-            
-           <programlisting><![CDATA[<many-to-one name="owner" property-ref="identity.ssn" column="OWNER_SSN"/>]]></programlisting>           
-            
+
+           <programlisting><![CDATA[<many-to-one name="owner" property-ref="identity.ssn" column="OWNER_SSN"/>]]></programlisting>
+
         </sect2>
 
         <sect2 id="mapping-declaration-onetoone" revision="3">
             <title>one-to-one</title>
 
             <para>
-                A one-to-one association to another persistent class is declared using a 
+                A one-to-one association to another persistent class is declared using a
                 <literal>one-to-one</literal> element.
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="onetoone1" coords="2 70"/>
@@ -1754,13 +1920,13 @@
                     <callout arearefs="onetoone1">
                         <para>
                             <literal>name</literal>: The name of the property.
-                        </para>                
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="onetoone2">
                         <para>
                             <literal>class</literal> (optional - defaults to the property type
                             determined by reflection): The name of the associated class.
-                        </para>                   
+                        </para>
                     </callout>
                     <callout arearefs="onetoone3">
                         <para>
@@ -1775,21 +1941,21 @@
                             class. This option affects the order in which <literal>save()</literal> and
                             <literal>delete()</literal> are cascaded, and determines whether the association
                             may be proxied (it is also used by the schema export tool).
-                        </para>                  
+                        </para>
                     </callout>
                     <callout arearefs="onetoone5">
                         <para>
-                            <literal>fetch</literal> (optional - defaults to <literal>select</literal>): 
+                            <literal>fetch</literal> (optional - defaults to <literal>select</literal>):
                             Chooses between outer-join fetching or sequential select fetching.
-                        </para>              
+                        </para>
                     </callout>
                     <callout arearefs="onetoone6">
                         <para>
                             <literal>property-ref</literal>: (optional) The name of a property of the associated class
                             that is joined to the primary key of this class. If not specified, the primary key of
                             the associated class is used.
-                        </para>                
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="onetoone7">
                         <para>
                             <literal>access</literal> (optional - defaults to <literal>property</literal>): The
@@ -1800,16 +1966,16 @@
                         <para>
                             <literal>formula</literal> (optional): Almost all one to one associations map to the
                             primary key of the owning entity. In the rare case that this is not the case, you may
-                            specify a some other column, columns or expression to join on using an SQL formula. (See 
+                            specify a some other column, columns or expression to join on using an SQL formula. (See
                             <literal>org.hibernate.test.onetooneformula</literal> for an example.)
                         </para>
                     </callout>
                     <callout arearefs="onetoone9">
                         <para>
-                            <literal>lazy</literal> (optional - defaults to <literal>proxy</literal>): 
+                            <literal>lazy</literal> (optional - defaults to <literal>proxy</literal>):
                             By default, single point associations are proxied. <literal>lazy="no-proxy"</literal>
-                            specifies that the property should be fetched lazily when the instance variable 
-                            is first accessed (requires build-time bytecode instrumentation). 
+                            specifies that the property should be fetched lazily when the instance variable
+                            is first accessed (requires build-time bytecode instrumentation).
                             <literal>lazy="false"</literal> specifies that the association will always
                             be eagerly fetched. <emphasis>Note that if <literal>constrained="false"</literal>,
                             proxying is impossible and Hibernate will eager fetch the association!</emphasis>
@@ -1818,11 +1984,11 @@
                     <callout arearefs="onetoone10">
                         <para>
                             <literal>entity-name</literal> (optional): The entity name of the associated class.
-                        </para>                   
+                        </para>
                     </callout>
                 </calloutlist>
             </programlistingco>
-        
+
             <para>
                 There are two varieties of one-to-one association:
             </para>
@@ -1834,16 +2000,16 @@
                 unique foreign key associations
             </para></listitem>
             </itemizedlist>
-            
+
             <para>
                 Primary key associations don't need an extra table column; if two rows are related by
-                the association then the two table rows share the same primary key value. So if you want 
+                the association then the two table rows share the same primary key value. So if you want
                 two objects to be related by a primary key association, you must make sure that they
                 are assigned the same identifier value!
             </para>
-            
+
             <para>
-                For a primary key association, add the following mappings to <literal>Employee</literal> and 
+                For a primary key association, add the following mappings to <literal>Employee</literal> and
                 <literal>Person</literal>, respectively.
             </para>
 
@@ -1875,17 +2041,17 @@
             </para>
 
             <para>
-                Alternatively, a foreign key with a unique constraint, from <literal>Employee</literal> to 
+                Alternatively, a foreign key with a unique constraint, from <literal>Employee</literal> to
                 <literal>Person</literal>, may be expressed as:
             </para>
-            
+
             <programlisting><![CDATA[<many-to-one name="person" class="Person" column="PERSON_ID" unique="true"/>]]></programlisting>
-            
+
             <para>
-                And this association may be made bidirectional by adding the following to the 
+                And this association may be made bidirectional by adding the following to the
                 <literal>Person</literal> mapping:
             </para>
-            
+
            <programlisting><![CDATA[<one-to-one name"employee" class="Employee" property-ref="person"/>]]></programlisting>
 
         </sect2>
@@ -1907,9 +2073,9 @@
                 Hibernate will generate the necessary unique key and nullability constraints, and your
                 mapping will be more self-documenting.
             </para>
-            
+
             <para>
-                We strongly recommend that you implement <literal>equals()</literal> and 
+                We strongly recommend that you implement <literal>equals()</literal> and
                 <literal>hashCode()</literal> to compare the natural key properties of the entity.
             </para>
 
@@ -1920,14 +2086,14 @@
             <itemizedlist spacing="compact">
                 <listitem>
                     <para>
-                        <literal>mutable</literal> (optional, defaults to <literal>false</literal>): 
+                        <literal>mutable</literal> (optional, defaults to <literal>false</literal>):
                         By default, natural identifier properties as assumed to be immutable (constant).
                     </para>
                 </listitem>
             </itemizedlist>
-            
+
         </sect2>
-        
+
         <sect2 id="mapping-declaration-component" revision="2">
             <title>component, dynamic-component</title>
 
@@ -1948,9 +2114,9 @@
                     <area id="component6" coords="7 45"/>
                     <area id="component7" coords="8 45"/>
                     <area id="component8" coords="9 45"/>
-                </areaspec>            
-                <programlisting><![CDATA[<component 
-        name="propertyName" 
+                </areaspec>
+                <programlisting><![CDATA[<component
+        name="propertyName"
         class="className"
         insert="true|false"
         update="true|false"
@@ -1960,7 +2126,7 @@
         unique="true|false"
         node="element-name|."
 >
-        
+
         <property ...../>
         <many-to-one .... />
         ........
@@ -1969,26 +2135,26 @@
                     <callout arearefs="component1">
                         <para>
                             <literal>name</literal>: The name of the property.
-                        </para>               
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="component2">
                         <para>
                             <literal>class</literal> (optional - defaults to the property type
                             determined by reflection): The name of the component (child) class.
-                        </para>                 
+                        </para>
                     </callout>
                     <callout arearefs="component3">
                         <para>
-                            <literal>insert</literal>: Do the mapped columns appear in SQL 
+                            <literal>insert</literal>: Do the mapped columns appear in SQL
                             <literal>INSERT</literal>s?
-                        </para>               
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="component4">
                         <para>
-                            <literal>update</literal>: Do the mapped columns appear in SQL 
+                            <literal>update</literal>: Do the mapped columns appear in SQL
                             <literal>UPDATE</literal>s?
-                        </para>               
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="component5">
                         <para>
                             <literal>access</literal> (optional - defaults to <literal>property</literal>): The
@@ -1998,7 +2164,7 @@
                    <callout arearefs="component6">
                         <para>
                             <literal>lazy</literal> (optional - defaults to <literal>false</literal>): Specifies
-                            that this component should be fetched lazily when the instance variable is first 
+                            that this component should be fetched lazily when the instance variable is first
                             accessed (requires build-time bytecode instrumentation).
                         </para>
                     </callout>
@@ -2006,7 +2172,7 @@
                             <para>
                                 <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>):
                                 Specifies that updates to this component do or do not require acquisition of the
-                                optimistic lock. In other words, determines if a version increment should occur when 
+                                optimistic lock. In other words, determines if a version increment should occur when
                                 this property is dirty.
                             </para>
                     </callout>
@@ -2036,7 +2202,7 @@
                 to be mapped as a component, where the property names refer to keys of the map, see
                 <xref linkend="components-dynamic"/>.
             </para>
-            
+
         </sect2>
 
         <sect2 id="mapping-declaration-properties" revision="2">
@@ -2045,7 +2211,7 @@
             <para>
                 The <literal>&lt;properties&gt;</literal> element allows the definition of a named,
                 logical grouping of properties of a class. The most important use of the construct
-                is that it allows a combination of properties to be the target of a 
+                is that it allows a combination of properties to be the target of a
                 <literal>property-ref</literal>. It is also a convenient way to define a multi-column
                 unique constraint.
             </para>
@@ -2057,15 +2223,15 @@
                     <area id="properties3" coords="4 45"/>
                     <area id="properties4" coords="5 45"/>
                     <area id="properties5" coords="6 45"/>
-                </areaspec>            
-                <programlisting><![CDATA[<properties 
-        name="logicalName" 
+                </areaspec>
+                <programlisting><![CDATA[<properties
+        name="logicalName"
         insert="true|false"
         update="true|false"
         optimistic-lock="true|false"
         unique="true|false"
 >
-        
+
         <property ...../>
         <many-to-one .... />
         ........
@@ -2073,22 +2239,22 @@
                 <calloutlist>
                     <callout arearefs="properties1">
                         <para>
-                            <literal>name</literal>: The logical name of the grouping - 
+                            <literal>name</literal>: The logical name of the grouping -
                             <emphasis>not</emphasis> an actual property name.
-                        </para>               
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="properties2">
                         <para>
-                            <literal>insert</literal>: Do the mapped columns appear in SQL 
+                            <literal>insert</literal>: Do the mapped columns appear in SQL
                             <literal>INSERT</literal>s?
-                        </para>               
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="properties3">
                         <para>
-                            <literal>update</literal>: Do the mapped columns appear in SQL 
+                            <literal>update</literal>: Do the mapped columns appear in SQL
                             <literal>UPDATE</literal>s?
-                        </para>               
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="properties4">
                             <para>
                                 <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>):
@@ -2106,15 +2272,15 @@
                     </callout>
                 </calloutlist>
             </programlistingco>
-            
+
             <para>
                 For example, if we have the following <literal>&lt;properties&gt;</literal> mapping:
             </para>
-            
+
             <programlisting><![CDATA[<class name="Person">
     <id name="personNumber"/>
     ...
-    <properties name="name" 
+    <properties name="name"
             unique="true" update="false">
         <property name="firstName"/>
         <property name="initial"/>
@@ -2123,22 +2289,22 @@
 </class>]]></programlisting>
 
             <para>
-                Then we might have some legacy data association which refers to this unique key of 
+                Then we might have some legacy data association which refers to this unique key of
                 the <literal>Person</literal> table, instead of to the primary key:
             </para>
 
-            <programlisting><![CDATA[<many-to-one name="person" 
+            <programlisting><![CDATA[<many-to-one name="person"
          class="Person" property-ref="name">
     <column name="firstName"/>
     <column name="initial"/>
     <column name="lastName"/>
 </many-to-one>]]></programlisting>
-            
+
             <para>
                 We don't recommend the use of this kind of thing outside the context of mapping
                 legacy data.
             </para>
-            
+
         </sect2>
 
         <sect2 id="mapping-declaration-subclass" revision="4">
@@ -2149,7 +2315,7 @@
                 the root persistent class. For the table-per-class-hierarchy
                 mapping strategy, the <literal>&lt;subclass&gt;</literal> declaration is used.
             </para>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="subclass1" coords="2 55"/>
@@ -2175,26 +2341,26 @@
                     <callout arearefs="subclass1">
                         <para>
                             <literal>name</literal>: The fully qualified class name of the subclass.
-                        </para>              
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="subclass2">
                         <para>
                             <literal>discriminator-value</literal> (optional - defaults to the class name): A
                             value that distiguishes individual subclasses.
-                        </para>               
+                        </para>
                     </callout>
                     <callout arearefs="subclass3">
                         <para>
-                            <literal>proxy</literal> (optional): Specifies a class or interface to use for 
+                            <literal>proxy</literal> (optional): Specifies a class or interface to use for
                             lazy initializing proxies.
-                        </para>               
+                        </para>
                     </callout>
                     <callout arearefs="subclass4">
                         <para>
-                            <literal>lazy</literal> (optional, defaults to <literal>true</literal>): Setting 
+                            <literal>lazy</literal> (optional, defaults to <literal>true</literal>): Setting
                             <literal>lazy="false"</literal> disables the use of lazy fetching.
                         </para>
-                    </callout>    
+                    </callout>
                 </calloutlist>
             </programlistingco>
 
@@ -2205,7 +2371,7 @@
                 define a unique <literal>discriminator-value</literal>. If none is specified, the
                 fully qualified Java class name is used.
             </para>
-            
+
             <para>
                 For information about inheritance mappings, see <xref linkend="inheritance"/>.
             </para>
@@ -2216,8 +2382,8 @@
             <title>joined-subclass</title>
 
             <para>
-                Alternatively, each subclass may be mapped to its own table (table-per-subclass 
-                mapping strategy). Inherited state is retrieved by joining with the table of the 
+                Alternatively, each subclass may be mapped to its own table (table-per-subclass
+                mapping strategy). Inherited state is retrieved by joining with the table of the
                 superclass. We use the <literal>&lt;joined-subclass&gt;</literal> element.
             </para>
 
@@ -2252,25 +2418,25 @@
                     <callout arearefs="joinedsubclass1">
                         <para>
                             <literal>name</literal>: The fully qualified class name of the subclass.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="joinedsubclass2">
                         <para>
                             <literal>table</literal>: The name of the subclass table.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="joinedsubclass3">
                         <para>
-                            <literal>proxy</literal> (optional): Specifies a class or interface to use 
+                            <literal>proxy</literal> (optional): Specifies a class or interface to use
                             for lazy initializing proxies.
-                        </para>              
+                        </para>
                     </callout>
                     <callout arearefs="joinedsubclass4">
                         <para>
-                             <literal>lazy</literal> (optional, defaults to <literal>true</literal>): Setting 
+                             <literal>lazy</literal> (optional, defaults to <literal>true</literal>): Setting
                             <literal>lazy="false"</literal> disables the use of lazy fetching.
                          </para>
-                    </callout>    
+                    </callout>
                 </calloutlist>
             </programlistingco>
 
@@ -2280,7 +2446,7 @@
                 <literal>&lt;key&gt;</literal> element. The mapping at the start of the chapter
                 would be re-written as:
             </para>
-            
+
         <programlisting><![CDATA[<?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
         "-//Hibernate/Hibernate Mapping DTD//EN"
@@ -2324,7 +2490,7 @@
 
            <para>
                A third option is to map only the concrete classes of an inheritance hierarchy
-               to tables, (the table-per-concrete-class strategy) where each table defines all 
+               to tables, (the table-per-concrete-class strategy) where each table defines all
                persistent state of the class, including inherited state. In Hibernate, it is
                not absolutely necessary to explicitly map such inheritance hierarchies. You
                can simply map each class with a separate <literal>&lt;class&gt;</literal>
@@ -2363,22 +2529,22 @@
                     <callout arearefs="unionsubclass1">
                         <para>
                             <literal>name</literal>: The fully qualified class name of the subclass.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="unionsubclass2">
                         <para>
                             <literal>table</literal>: The name of the subclass table.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="unionsubclass3">
                         <para>
-                            <literal>proxy</literal> (optional): Specifies a class or interface to use 
+                            <literal>proxy</literal> (optional): Specifies a class or interface to use
                             for lazy initializing proxies.
-                        </para>              
+                        </para>
                     </callout>
                     <callout arearefs="unionsubclass4">
                         <para>
-                            <literal>lazy</literal> (optional, defaults to <literal>true</literal>): Setting 
+                            <literal>lazy</literal> (optional, defaults to <literal>true</literal>): Setting
                             <literal>lazy="false"</literal> disables the use of lazy fetching.
                          </para>
                     </callout>
@@ -2419,9 +2585,9 @@
         fetch="join|select"
         inverse="true|false"
         optional="true|false">
-        
+
         <key ... />
-        
+
         <property ... />
         ...
 </join>]]></programlisting>
@@ -2447,13 +2613,13 @@
                     <callout arearefs="join4">
                         <para>
                             <literal>fetch</literal> (optional - defaults to <literal>join</literal>):
-                            If set to <literal>join</literal>, the default, Hibernate will use an inner join 
-                            to retrieve a <literal>&lt;join&gt;</literal> defined by a class or its superclasses 
+                            If set to <literal>join</literal>, the default, Hibernate will use an inner join
+                            to retrieve a <literal>&lt;join&gt;</literal> defined by a class or its superclasses
                             and an outer join for a <literal>&lt;join&gt;</literal> defined by a subclass.
-                            If set to <literal>select</literal> then Hibernate will use a sequential select for 
-                            a <literal>&lt;join&gt;</literal> defined on a subclass, which will be issued only 
+                            If set to <literal>select</literal> then Hibernate will use a sequential select for
+                            a <literal>&lt;join&gt;</literal> defined on a subclass, which will be issued only
                             if a row turns out to represent an instance of the subclass. Inner joins will still
-                            be used to retrieve a <literal>&lt;join&gt;</literal> defined by the class and its 
+                            be used to retrieve a <literal>&lt;join&gt;</literal> defined by the class and its
                             superclasses.
                         </para>
                     </callout>
@@ -2467,7 +2633,7 @@
                     <callout arearefs="join6">
                         <para>
                             <literal>optional</literal> (optional - defaults to <literal>false</literal>):
-                            If enabled, Hibernate will insert a row only if the properties defined by this 
+                            If enabled, Hibernate will insert a row only if the properties defined by this
                             join are non-null and will always use an outer join to retrieve the properties.
                         </para>
                     </callout>
@@ -2539,15 +2705,15 @@
                     </callout>
                     <callout arearefs="key2">
                         <para>
-                            <literal>on-delete</literal> (optional, defaults to <literal>noaction</literal>): 
-                            Specifies whether the foreign key constraint has database-level cascade delete 
+                            <literal>on-delete</literal> (optional, defaults to <literal>noaction</literal>):
+                            Specifies whether the foreign key constraint has database-level cascade delete
                             enabled.
                         </para>
                     </callout>
                     <callout arearefs="key3">
                         <para>
                             <literal>property-ref</literal> (optional): Specifies that the foreign key refers
-                            to columns that are not the primary key of the orginal table. (Provided for 
+                            to columns that are not the primary key of the orginal table. (Provided for
                             legacy data.)
                         </para>
                     </callout>
@@ -2561,7 +2727,7 @@
                     <callout arearefs="key5">
                         <para>
                             <literal>update</literal> (optional): Specifies that the foreign key should never
-                            be updated (this is implied whenever the foreign key is also part of the primary 
+                            be updated (this is implied whenever the foreign key is also part of the primary
                             key).
                         </para>
                     </callout>
@@ -2575,13 +2741,13 @@
             </programlistingco>
 
             <para>
-                We recommend that for systems where delete performance is important, all keys should be 
+                We recommend that for systems where delete performance is important, all keys should be
                 defined <literal>on-delete="cascade"</literal>, and Hibernate will use a database-level
-                <literal>ON CASCADE DELETE</literal> constraint, instead of many individual 
+                <literal>ON CASCADE DELETE</literal> constraint, instead of many individual
                 <literal>DELETE</literal> statements. Be aware that this feature bypasses Hibernate's
                 usual optimistic locking strategy for versioned data.
             </para>
-            
+
             <para>
                 The <literal>not-null</literal> and <literal>update</literal> attributes are useful when
                 mapping a unidirectional one to many association. If you map a unidirectional one to many
@@ -2613,7 +2779,7 @@
         default="SQL expression"/>]]></programlisting>
 
             <programlisting><![CDATA[<formula>SQL expression</formula>]]></programlisting>
-        
+
             <para>
                 <literal>column</literal> and <literal>formula</literal> attributes may even be combined
                 within the same property or association mapping to express, for example, exotic join
@@ -2626,20 +2792,20 @@
     <formula>'MAILING'</formula>
 </many-to-one>]]></programlisting>
 
-    </sect2>  
-   	
+    </sect2>
+
         <sect2 id="mapping-declaration-import">
             <title>import</title>
 
             <para>
                 Suppose your application has two persistent classes with the same name, and you don't want to
-                specify the fully qualified (package) name in Hibernate queries. Classes may be "imported" 
-                explicitly, rather than relying upon <literal>auto-import="true"</literal>. You may even import 
+                specify the fully qualified (package) name in Hibernate queries. Classes may be "imported"
+                explicitly, rather than relying upon <literal>auto-import="true"</literal>. You may even import
                 classes and interfaces that are not explicitly mapped.
             </para>
-            
+
             <programlisting><![CDATA[<import class="java.lang.Object" rename="Universe"/>]]></programlisting>
-            
+
             <programlistingco>
                 <areaspec>
                     <area id="import1" coords="2 40"/>
@@ -2653,35 +2819,35 @@
                     <callout arearefs="import1">
                         <para>
                             <literal>class</literal>: The fully qualified class name of of any Java class.
-                        </para>              
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="import2">
                         <para>
                             <literal>rename</literal> (optional - defaults to the unqualified class name):
                             A name that may be used in the query language.
-                        </para>               
+                        </para>
                     </callout>
                 </calloutlist>
             </programlistingco>
-            
+
         </sect2>
-        
+
         <sect2 id="mapping-types-anymapping" revision="2">
             <title>any</title>
-            
+
             <para>
-                There is one further type of property mapping. The <literal>&lt;any&gt;</literal> mapping element 
+                There is one further type of property mapping. The <literal>&lt;any&gt;</literal> mapping element
                 defines a polymorphic association to classes from multiple tables. This type of mapping always
-                requires more than one column. The first column holds the type of the associated entity. 
+                requires more than one column. The first column holds the type of the associated entity.
                 The remaining columns hold the identifier. It is impossible to specify a foreign key constraint
-                for this kind of association, so this is most certainly not meant as the usual way of mapping 
+                for this kind of association, so this is most certainly not meant as the usual way of mapping
                 (polymorphic) associations. You should use this only in very special cases (eg. audit logs,
                 user session data, etc).
             </para>
 
             <para>
-                 The <literal>meta-type</literal> attribute lets the application specify a custom type that 
-                 maps database column values to persistent classes which have identifier properties of the 
+                 The <literal>meta-type</literal> attribute lets the application specify a custom type that
+                 maps database column values to persistent classes which have identifier properties of the
                  type specified by <literal>id-type</literal>. You must specify the mapping from values of
                  the meta-type to class names.
             </para>
@@ -2722,25 +2888,25 @@
                     <callout arearefs="any1">
                         <para>
                             <literal>name</literal>: the property name.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="any2">
                         <para>
                             <literal>id-type</literal>: the identifier type.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="any3">
                         <para>
-                            <literal>meta-type</literal> (optional - defaults to <literal>string</literal>): 
+                            <literal>meta-type</literal> (optional - defaults to <literal>string</literal>):
                             Any type that is allowed for a discriminator mapping.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="any4">
                         <para>
-                            <literal>cascade</literal> (optional- defaults to <literal>none</literal>): 
+                            <literal>cascade</literal> (optional- defaults to <literal>none</literal>):
                             the cascade style.
-                        </para>            
-                    </callout>                   
+                        </para>
+                    </callout>
                     <callout arearefs="any5">
                         <para>
                             <literal>access</literal> (optional - defaults to <literal>property</literal>): The
@@ -2749,7 +2915,7 @@
                     </callout>
                     <callout arearefs="any6">
                         <para>
-                            <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>): 
+                            <literal>optimistic-lock</literal> (optional - defaults to <literal>true</literal>):
                             Specifies that updates to this property do or do not require acquisition of the
                             optimistic lock. In other words, define if a version increment should occur if this
                             property is dirty.
@@ -2864,7 +3030,7 @@
                         <term><literal>date, time, timestamp</literal></term>
                         <listitem>
                             <para>
-                                Type mappings from <literal>java.util.Date</literal> and its subclasses 
+                                Type mappings from <literal>java.util.Date</literal> and its subclasses
                                 to SQL types <literal>DATE</literal>, <literal>TIME</literal> and
                                 <literal>TIMESTAMP</literal> (or equivalent).
                             </para>
@@ -2885,7 +3051,7 @@
                         <listitem>
                             <para>
                                 Type mappings from <literal>java.math.BigDecimal</literal> and
-                                <literal>java.math.BigInteger</literal> to <literal>NUMERIC</literal> 
+                                <literal>java.math.BigInteger</literal> to <literal>NUMERIC</literal>
                                 (or Oracle <literal>NUMBER</literal>).
                             </para>
                         </listitem>
@@ -2895,12 +3061,12 @@
                         <listitem>
                             <para>
                                 Type mappings from <literal>java.util.Locale</literal>,
-                                <literal>java.util.TimeZone</literal> and 
-                                <literal>java.util.Currency</literal> 
+                                <literal>java.util.TimeZone</literal> and
+                                <literal>java.util.Currency</literal>
                                 to <literal>VARCHAR</literal> (or Oracle <literal>VARCHAR2</literal>).
-                                Instances of <literal>Locale</literal> and <literal>Currency</literal> are 
+                                Instances of <literal>Locale</literal> and <literal>Currency</literal> are
                                 mapped to their ISO codes. Instances of <literal>TimeZone</literal> are
-                                mapped to their <literal>ID</literal>. 
+                                mapped to their <literal>ID</literal>.
                             </para>
                         </listitem>
                     </varlistentry>
@@ -2926,7 +3092,7 @@
                         <term><literal>text</literal></term>
                         <listitem>
                             <para>
-                                Maps long Java strings to a SQL <literal>CLOB</literal> or 
+                                Maps long Java strings to a SQL <literal>CLOB</literal> or
                                 <literal>TEXT</literal> type.
                             </para>
                         </listitem>
@@ -2937,7 +3103,7 @@
                             <para>
                                 Maps serializable Java types to an appropriate SQL binary type. You
                                 may also indicate the Hibernate type <literal>serializable</literal> with
-                                the name of a serializable Java class or interface that does not default 
+                                the name of a serializable Java class or interface that does not default
                                 to a basic type.
                             </para>
                         </listitem>
@@ -2965,21 +3131,21 @@
                                 Java types, and the application treats the object as immutable. For
                                 example, you should not call <literal>Date.setTime()</literal> for an
                                 instance mapped as <literal>imm_timestamp</literal>. To change the
-                                value of the property, and have that change made persistent, the 
+                                value of the property, and have that change made persistent, the
                                 application must assign a new (nonidentical) object to the property.
                             </para>
                         </listitem>
                     </varlistentry>
                 </variablelist>
-            
+
             </para>
 
             <para>
                 Unique identifiers of entities and collections may be of any basic type except
-                <literal>binary</literal>, <literal>blob</literal> and <literal>clob</literal>. 
+                <literal>binary</literal>, <literal>blob</literal> and <literal>clob</literal>.
                 (Composite identifiers are also allowed, see below.)
             </para>
-            
+
             <para>
                 The basic value types have corresponding <literal>Type</literal> constants defined on
                 <literal>org.hibernate.Hibernate</literal>. For example, <literal>Hibernate.STRING</literal>
@@ -2994,18 +3160,18 @@
             <para>
                 It is relatively easy for developers to create their own value types. For example,
                 you might want to persist properties of type <literal>java.lang.BigInteger</literal>
-                to <literal>VARCHAR</literal> columns. Hibernate does not provide a built-in type 
-                for this. But custom types are not limited to mapping a property (or collection element) 
-                to a single table column. So, for example, you might have a Java property 
+                to <literal>VARCHAR</literal> columns. Hibernate does not provide a built-in type
+                for this. But custom types are not limited to mapping a property (or collection element)
+                to a single table column. So, for example, you might have a Java property
                 <literal>getName()</literal>/<literal>setName()</literal> of type
-                <literal>java.lang.String</literal> that is persisted to the columns 
-                <literal>FIRST_NAME</literal>, <literal>INITIAL</literal>, <literal>SURNAME</literal>. 
+                <literal>java.lang.String</literal> that is persisted to the columns
+                <literal>FIRST_NAME</literal>, <literal>INITIAL</literal>, <literal>SURNAME</literal>.
             </para>
-            
+
             <para>
                 To implement a custom type, implement either <literal>org.hibernate.UserType</literal>
                 or <literal>org.hibernate.CompositeUserType</literal> and declare properties using the
-                fully qualified classname of the type. Check out 
+                fully qualified classname of the type. Check out
                 <literal>org.hibernate.test.DoubleStringType</literal> to see the kind of things that
                 are possible.
             </para>
@@ -3019,21 +3185,21 @@
                 Notice the use of <literal>&lt;column&gt;</literal> tags to map a property to multiple
                 columns.
             </para>
-            
+
             <para>
                 The <literal>CompositeUserType</literal>, <literal>EnhancedUserType</literal>,
-                <literal>UserCollectionType</literal>, and <literal>UserVersionType</literal> 
+                <literal>UserCollectionType</literal>, and <literal>UserVersionType</literal>
                 interfaces provide support for more specialized uses.
             </para>
-            
+
             <para>
-                You may even supply parameters to a <literal>UserType</literal> in the mapping file. To 
-                do this, your <literal>UserType</literal> must implement the 
-                <literal>org.hibernate.usertype.ParameterizedType</literal> interface. To supply parameters 
-                to your custom type, you can use the <literal>&lt;type&gt;</literal> element in your mapping 
+                You may even supply parameters to a <literal>UserType</literal> in the mapping file. To
+                do this, your <literal>UserType</literal> must implement the
+                <literal>org.hibernate.usertype.ParameterizedType</literal> interface. To supply parameters
+                to your custom type, you can use the <literal>&lt;type&gt;</literal> element in your mapping
                 files.
             </para>
-            
+
             <programlisting><![CDATA[<property name="priority">
     <type name="com.mycompany.usertypes.DefaultValueIntegerType">
         <param name="default">0</param>
@@ -3041,17 +3207,17 @@
 </property>]]></programlisting>
 
             <para>
-                The <literal>UserType</literal> can now retrieve the value for the parameter named 
+                The <literal>UserType</literal> can now retrieve the value for the parameter named
                 <literal>default</literal> from the <literal>Properties</literal> object passed to it.
             </para>
-            
+
             <para>
-                If you use a certain <literal>UserType</literal> very often, it may be useful to define a 
+                If you use a certain <literal>UserType</literal> very often, it may be useful to define a
                 shorter name for it. You can do this using the <literal>&lt;typedef&gt;</literal> element.
                 Typedefs assign a name to a custom type, and may also contain a list of default
                 parameter values if the type is parameterized.
             </para>
-            
+
             <programlisting><![CDATA[<typedef class="com.mycompany.usertypes.DefaultValueIntegerType" name="default_zero">
     <param name="default">0</param>
 </typedef>]]></programlisting>
@@ -3062,20 +3228,20 @@
                 It is also possible to override the parameters supplied in a typedef on a case-by-case basis
                 by using type parameters on the property mapping.
             </para>
-            
+
             <para>
                 Even though Hibernate's rich range of built-in types and support for components means you
                 will very rarely <emphasis>need</emphasis> to use a custom type, it is nevertheless
                 considered good form to use custom types for (non-entity) classes that occur frequently
                 in your application. For example, a <literal>MonetaryAmount</literal> class is a good
-                candidate for a <literal>CompositeUserType</literal>, even though it could easily be mapped 
-                as a component. One motivation for this is abstraction. With a custom type, your mapping 
-                documents would be future-proofed against possible changes in your way of representing 
+                candidate for a <literal>CompositeUserType</literal>, even though it could easily be mapped
+                as a component. One motivation for this is abstraction. With a custom type, your mapping
+                documents would be future-proofed against possible changes in your way of representing
                 monetary values.
             </para>
 
         </sect2>
-        
+
     </sect1>
 
     <sect1 id="mapping-entityname">
@@ -3087,22 +3253,22 @@
             Hibernate lets you specify the entity name when working with persistent objects, when writing
             queries, or when mapping associations to the named entity.
         </para>
-        
-        <programlisting><![CDATA[<class name="Contract" table="Contracts" 
+
+        <programlisting><![CDATA[<class name="Contract" table="Contracts"
         entity-name="CurrentContract">
     ...
-    <set name="history" inverse="true" 
+    <set name="history" inverse="true"
             order-by="effectiveEndDate desc">
         <key column="currentContractId"/>
         <one-to-many entity-name="HistoricalContract"/>
     </set>
 </class>
 
-<class name="Contract" table="ContractHistory" 
+<class name="Contract" table="ContractHistory"
         entity-name="HistoricalContract">
     ...
-    <many-to-one name="currentContract" 
-            column="currentContractId" 
+    <many-to-one name="currentContract"
+            column="currentContractId"
             entity-name="CurrentContract"/>
 </class>]]></programlisting>
 
@@ -3130,10 +3296,10 @@
 
     </sect1>
 
-  	
+
    	<sect1 id="mapping-alternatives">
    	<title>Metadata alternatives</title>
-   	
+
    	<para>
    	    XML isn't for everyone, and so there are some alternative ways to define O/R mapping metadata in Hibernate.
    	</para>
@@ -3304,7 +3470,7 @@
             Note that support for JDK 5.0 Annotations (and JSR-220) is still work in progress and
             not completed. Please refer to the Hibernate Annotations module for more details.
         </para>
-    
+
     </sect2>
     </sect1>
 




More information about the hibernate-commits mailing list