From: <tu...@us...> - 2003-02-23 13:45:31
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/html In directory sc8-pr-cvs1:/tmp/cvs-serv13704/doc/reference/html Modified Files: adv-or-mapping.html architecture.html best-practices.html examples.html index.html manipulating-data.html or-mapping.html persistent-classes.html query-language.html session-configuration.html transactions.html Log Message: Updated Index: adv-or-mapping.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/adv-or-mapping.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** adv-or-mapping.html 28 Jan 2003 13:25:09 -0000 1.2 --- adv-or-mapping.html 23 Feb 2003 13:45:25 -0000 1.3 *************** *** 1,5 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 5. Advanced O/R Mapping</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.49"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="up" href="index.html" title="Hibernate Reference Documentation"><link rel="previous" href="or-mapping.html" title="Chapter 4. Basic O/R Mapping"><link rel="next" href="manipulating-data.html" title="Chapter 6. Manipulating Persistent Data"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Advanced O/R Mapping</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="or-mapping.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manipulating-data.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="adv-or-mapping"></a>Chapter 5. Advanced O/R Mapping</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="adv-or-mapping.html#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-1">Persistent Collections</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-11">Ternary Associations</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-12">Collection Example</a></dt></dl></dd><dt><a href="adv-or-mapping.html#adv-or-mapping-s2">Components</a></dt><dd><dl><dt><a href="adv-or-mapping.html#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s2-2">In Collections</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s2-3">As Composite Identifiers</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s2-4">Dynabean components</a></dt></dl></dd><dt><a href="adv-or-mapping.html#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt><a href="adv-or-mapping.html#adv-or-mapping-s3-1">Mapping</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt><a href="adv-or-mapping.html#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="adv-or-mapping-s1"></a>Collections</h2></div></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="adv-or-mapping-s1-1"></a>Persistent Collections</h3></div></div><p> This section does not contain much example Java code. We assume you already know how to use Java's collections framework. If so, theres not really anything more --- 1,5 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 5. Advanced O/R Mapping</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="up" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="previous" href="or-mapping.html" title="Chapter 4. Basic O/R Mapping"><link rel="next" href="manipulating-data.html" title="Chapter 6. Manipulating Persistent Data"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Advanced O/R Mapping</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="or-mapping.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manipulating-data.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="adv-or-mapping"></a>Chapter 5. Advanced O/R Mapping</h2></div></div><div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="adv-or-mapping-s1"></a>5.1. Collections</h2></div></div><div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="adv-or-mapping-s1-1"></a>5.1.1. Persistent Collections</h3></div></div><div></div></div><p> This section does not contain much example Java code. We assume you already know [...981 lines suppressed...] ! Certain operations do <span class="emphasis"><em>not</em></span> require proxy initialization ! </p><div class="itemizedlist"><ul type="disc" compact><li><p> ! <tt class="literal">equals()</tt>, if the persistent class does not override ! <tt class="literal">equals()</tt> </p></li><li><p> ! <tt class="literal">hashCode()</tt>, if the persistent class does not override ! <tt class="literal">hashCode()</tt> </p></li><li><p> The identifier getter method </p></li></ul></div><p> ! Hibernate will detect persistent classes that override <tt class="literal">equals()</tt> or ! <tt class="literal">hashCode()</tt>. </p><p> ! Please note that Hibernate no longer uses <tt class="literal">java.lang.reflect.Proxy</tt> for its proxies. Instead it uses the excellent CGLIB package. </p><p> Exceptions that occur while initializing a proxy are wrapped in a ! <tt class="literal">LazyInitializationException</tt>. ! </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="or-mapping.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="manipulating-data.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Basic O/R Mapping </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Manipulating Persistent Data</td></tr></table></div></body></html> \ No newline at end of file Index: architecture.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/architecture.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** architecture.html 28 Jan 2003 13:25:09 -0000 1.2 --- architecture.html 23 Feb 2003 13:45:25 -0000 1.3 *************** *** 1,7 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 1. Architecture</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.49"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="up" href="index.html" title="Hibernate Reference Documentation"><link rel="previous" href="index.html" title="Hibernate Reference Documentation"><link rel="next" href="session-configuration.html" title="Chapter 2. SessionFactory Configuration"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Architecture</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="session-configuration.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="architecture"></a>Chapter 1. Architecture</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="architecture.html#architecture-s1">Overview</a></dt><dt><a href="architecture.html#architecture-s2">Persistent Object Identity</a></dt><dt><a href="architecture.html#architecture-s3">JMX Integration</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="architecture-s1"></a>Overview</h2></div></div><p> A (very) high-level view of the Hibernate architecture: ! </p><div class="mediaobject"><img src="../images/overview.gif" align="center"></div><p> This diagram shows Hibernate using the database and configuration data to provide persistence services (and persistent objects) to the application. --- 1,7 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 1. Architecture</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="up" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="previous" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="next" href="session-configuration.html" title="Chapter 2. SessionFactory Configuration"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Architecture</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="session-configuration.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="architecture"></a>Chapter 1. Architecture</h2></div></div><div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="architecture-s1"></a>1.1. Overview</h2></div></div><div></div></div><p> A (very) high-level view of the Hibernate architecture: ! </p><div class="mediaobject" align="center"><img src="../images/overview.gif" align="middle"></div><p> This diagram shows Hibernate using the database and configuration data to provide persistence services (and persistent objects) to the application. *************** *** 12,79 **** provide its own JDBC connections and manage its own transactions. This approach uses a minimal subset of Hibernate's APIs: ! </p><div class="mediaobject"><img src="../images/lite.gif" align="center"></div><p> The "full cream" architecture abstracts the application away from the underlying JDBC / JTA APIs and lets Hibernate take care of the details. ! </p><div class="mediaobject"><img src="../images/full_cream.gif" align="center"></div><p> Heres some definitions of the objects in the diagrams: ! </p><div class="itemizedlist"><ul type="disc"><li><p> ! <tt>net.sf.hibernate.SessionFactory</tt> ! </p></li><li><p> ! <tt>net.sf.hibernate.Session</tt> ! </p></li><li><p> ! <tt>net.sf.hibernate.Transaction</tt> ! </p></li><li><p> ! <tt>net.sf.hibernate.TransactionFactory</tt> ! </p></li><li><p> ! <tt>net.sf.hibernate.connection.ConnectionProvider</tt> ! </p></li><li><p> ! persistent objects and collections ! </p></li><li><p> ! transient objects and collections ! </p></li></ul></div><div class="variablelist"><dl><dt><span class="term">SessionFactory</span></dt><dd><p> ! A threadsafe (immutable) cache of compiled mappings. A factory for ! <tt>Session</tt>. A client of <tt>ConnectionProvider</tt>. ! </p></dd><dt><span class="term">Session</span></dt><dd><p> ! A single-threaded, short-lived object representing a conversation between ! the application and the persistent store. Wraps a JDBC connection. Factory ! for <tt>Transaction</tt>. Manages persistent objects to the ! application. ! </p></dd><dt><span class="term">Persistent Objects and Collections</span></dt><dd><p> ! Short-lived, single threaded objects containing persistent state and business ! function. These might be ordinary JavaBeans, the only special thing about them ! is that they are currently associated with (exactly one) ! <tt>Session</tt>. ! </p></dd><dt><span class="term">Transient Objects and Collections</span></dt><dd><p> ! Instances of persistent classes that are not currently associated with a ! <tt>Session</tt>. They may have been instantiated by ! the application and not (yet) persisted or they may have been instantiated by a ! closed <tt>Session</tt>. ! </p></dd><dt><span class="term">Transaction</span></dt><dd><p> ! ( Optional ) A single-threaded, short-lived object used by the application to ! specify atomic units of work. Abstracts application from underlying JDBC, ! JTA or CORBA transaction. A <tt>Session</tt> might span several ! <tt>Transaction</tt>s. ! </p></dd><dt><span class="term">ConnectionProvider</span></dt><dd><p> ! ( Optional ) A factory for JDBC connections. Abstracts application from ! underlying <tt>Datasource</tt> or <tt>DriverManager</tt>. ! Not exposed to application. ! </p></dd><dt><span class="term">TransactionFactory</span></dt><dd><p> ! ( Optional ) A factory for <tt>Transaction</tt>. Not exposed to the ! application. ! </p></dd></dl></div><p> Given a "lite" architecture, the application bypasses the ! <tt>Transaction</tt> / <tt>TransactionFactory</tt> and / or ! <tt>ConnectionProvider</tt> APIs to talk to JTA or JDBC directly. ! </p></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="architecture-s2"></a>Persistent Object Identity</h2></div></div><p> The application may concurrently access the same persistent state in two different sessions. However, an instance of a persistent class is never shared ! between two <tt>Session</tt> instances. Hence there are two different notions of identity: ! </p><table class="simplelist" border="0" summary="Simple list"><tr><td>Persistent Identity</td><td> ! <tt>foo.getId().equals( bar.getId() )</tt> ! </td></tr><tr><td>JVM Identity</td><td> ! <tt>foo==bar</tt> ! </td></tr></table><p> ! Then for objects returned by a <span class="emphasis"><i>particular</i></span> <tt>Session</tt>, the two notions are equivalent. However, while the application might concurrently access the "same" (persistent identity) business object in two different sessions, the two --- 12,67 ---- provide its own JDBC connections and manage its own transactions. This approach uses a minimal subset of Hibernate's APIs: ! </p><div class="mediaobject" align="center"><img src="../images/lite.gif" align="middle"></div><p> The "full cream" architecture abstracts the application away from the underlying JDBC / JTA APIs and lets Hibernate take care of the details. ! </p><div class="mediaobject" align="center"><img src="../images/full_cream.gif" align="middle"></div><p> Heres some definitions of the objects in the diagrams: ! ! </p><div class="variablelist"><dl><dt><span class="term">SessionFactory (<tt class="literal">net.sf.hibernate.SessionFactory</tt>)</span></dt><dd><p> ! A threadsafe (immutable) cache of compiled mappings. A factory for ! <tt class="literal">Session</tt>. A client of <tt class="literal">ConnectionProvider</tt>. ! </p></dd><dt><span class="term">Session (<tt class="literal">net.sf.hibernate.Session</tt>)</span></dt><dd><p> ! A single-threaded, short-lived object representing a conversation between ! the application and the persistent store. Wraps a JDBC connection. Factory ! for <tt class="literal">Transaction</tt>. Manages persistent objects to the ! application. ! </p></dd><dt><span class="term">Persistent Objects and Collections</span></dt><dd><p> ! Short-lived, single threaded objects containing persistent state and business ! function. These might be ordinary JavaBeans, the only special thing about them ! is that they are currently associated with (exactly one) ! <tt class="literal">Session</tt>. ! </p></dd><dt><span class="term">Transient Objects and Collections</span></dt><dd><p> ! Instances of persistent classes that are not currently associated with a ! <tt class="literal">Session</tt>. They may have been instantiated by ! the application and not (yet) persisted or they may have been instantiated by a ! closed <tt class="literal">Session</tt>. ! </p></dd><dt><span class="term">Transaction (<tt class="literal">net.sf.hibernate.Transaction</tt>)</span></dt><dd><p> ! (Optional) A single-threaded, short-lived object used by the application to ! specify atomic units of work. Abstracts application from underlying JDBC, ! JTA or CORBA transaction. A <tt class="literal">Session</tt> might span several ! <tt class="literal">Transaction</tt>s. ! </p></dd><dt><span class="term">ConnectionProvider (<tt class="literal">net.sf.hibernate.connection.ConnectionProvider</tt>)</span></dt><dd><p> ! (Optional) A factory for JDBC connections. Abstracts application from ! underlying <tt class="literal">Datasource</tt> or <tt class="literal">DriverManager</tt>. ! Not exposed to application. ! </p></dd><dt><span class="term">TransactionFactory (<tt class="literal">net.sf.hibernate.TransactionFactory</tt>)</span></dt><dd><p> ! (Optional) A factory for <tt class="literal">Transaction</tt>. Not exposed to the ! application. ! </p></dd></dl></div><p> ! </p><p> Given a "lite" architecture, the application bypasses the ! <tt class="literal">Transaction</tt> / <tt class="literal">TransactionFactory</tt> and / or ! <tt class="literal">ConnectionProvider</tt> APIs to talk to JTA or JDBC directly. ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="architecture-s2"></a>1.2. Persistent Object Identity</h2></div></div><div></div></div><p> The application may concurrently access the same persistent state in two different sessions. However, an instance of a persistent class is never shared ! between two <tt class="literal">Session</tt> instances. Hence there are two different notions of identity: ! </p><div class="variablelist"><dl><dt><span class="term">Persistent Identity</span></dt><dd><p> ! <tt class="literal">foo.getId().equals( bar.getId() )</tt> ! </p></dd><dt><span class="term">JVM Identity</span></dt><dd><p> ! <tt class="literal">foo==bar</tt> ! </p></dd></dl></div><p> ! Then for objects returned by a <span class="emphasis"><em>particular</em></span> <tt class="literal">Session</tt>, the two notions are equivalent. However, while the application might concurrently access the "same" (persistent identity) business object in two different sessions, the two *************** *** 82,90 **** This approach leaves Hibernate and the database to worry about concurrency (the application never needs to synchronize on any business object, as long as it sticks to a ! single thread per <tt>Session</tt>) or object identity (within a session the ! application may safely use <tt>==</tt> to compare objects). ! </p></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="architecture-s3"></a>JMX Integration</h2></div></div><p> JMX is the J2EE standard for management of Java components. Hibernate may be managed via a JMX standard MBean but because most application servers do not yet support JMX, Hibernate also affords some non-standard configuration mechanisms. ! </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="session-configuration.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Hibernate Reference Documentation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 2. SessionFactory Configuration</td></tr></table></div></body></html> \ No newline at end of file --- 70,78 ---- This approach leaves Hibernate and the database to worry about concurrency (the application never needs to synchronize on any business object, as long as it sticks to a ! single thread per <tt class="literal">Session</tt>) or object identity (within a session the ! application may safely use <tt class="literal">==</tt> to compare objects). ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="architecture-s3"></a>1.3. JMX Integration</h2></div></div><div></div></div><p> JMX is the J2EE standard for management of Java components. Hibernate may be managed via a JMX standard MBean but because most application servers do not yet support JMX, Hibernate also affords some non-standard configuration mechanisms. ! </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="session-configuration.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">HIBERNATE - Relational Persistence for Idiomatic Java </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 2. SessionFactory Configuration</td></tr></table></div></body></html> \ No newline at end of file Index: best-practices.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/best-practices.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** best-practices.html 28 Jan 2003 13:25:09 -0000 1.2 --- best-practices.html 23 Feb 2003 13:45:25 -0000 1.3 *************** *** 1,8 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 10. Best Practices</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.49"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="up" href="index.html" title="Hibernate Reference Documentation"><link rel="previous" href="examples.html" title="Chapter 9. Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. Best Practices</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="examples.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> </td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="best-practices"></a>Chapter 10. Best Practices</h2></div></div><div class="variablelist"><dl><dt><span class="term">Write fine-grained classes and map them using <tt><component></tt> ! or <tt><component-element></tt>.</span></dt><dd><p> ! Use an <tt>Address</tt> class to encapsulate <tt>street</tt>, ! <tt>suburb</tt>, <tt>state</tt>, <tt>postcode</tt>. This encourages code reuse and simplifies refactoring. </p></dd><dt><span class="term">Declare identifier properties on persistent classes.</span></dt><dd><p> --- 1,8 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 10. Best Practices</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="up" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="previous" href="examples.html" title="Chapter 9. Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. Best Practices</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="examples.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> </td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="best-practices"></a>Chapter 10. Best Practices</h2></div></div><div></div></div><div class="variablelist"><dl><dt><span class="term">Write fine-grained classes and map them using <tt class="literal"><component></tt> ! or <tt class="literal"><component-element></tt>.</span></dt><dd><p> ! Use an <tt class="literal">Address</tt> class to encapsulate <tt class="literal">street</tt>, ! <tt class="literal">suburb</tt>, <tt class="literal">state</tt>, <tt class="literal">postcode</tt>. This encourages code reuse and simplifies refactoring. </p></dd><dt><span class="term">Declare identifier properties on persistent classes.</span></dt><dd><p> *************** *** 10,17 **** you should use them. We recommend that identifiers be 'synthetic' (generated, with no business meaning) and of a non-primitive type. For maximum flexibility, use ! <tt>java.lang.Long</tt> or <tt>java.lang.String</tt>. </p></dd><dt><span class="term">Place each class mapping in its own file.</span></dt><dd><p> ! Don't use a single monolithic mapping document. Map <tt>com.eg.Foo</tt> in ! the file <tt>com/eg/Foo.hbm.xml</tt>. This makes particularly good sense in a team environment. </p></dd><dt><span class="term">Load mappings as resources.</span></dt><dd><p> --- 10,17 ---- you should use them. We recommend that identifiers be 'synthetic' (generated, with no business meaning) and of a non-primitive type. For maximum flexibility, use ! <tt class="literal">java.lang.Long</tt> or <tt class="literal">java.lang.String</tt>. </p></dd><dt><span class="term">Place each class mapping in its own file.</span></dt><dd><p> ! Don't use a single monolithic mapping document. Map <tt class="literal">com.eg.Foo</tt> in ! the file <tt class="literal">com/eg/Foo.hbm.xml</tt>. This makes particularly good sense in a team environment. </p></dd><dt><span class="term">Load mappings as resources.</span></dt><dd><p> *************** *** 27,53 **** Hibernate lets the application manage JDBC connections. This approach should be considered a last-resort. If you can't use the built-in connections providers, consider providing your ! own implementation of <tt>net.sf.hibernate.connection.ConnectionProvider</tt>. </p></dd><dt><span class="term">Consider using a custom type.</span></dt><dd><p> Suppose you have a Java type, say from some library, that needs to be persisted but doesn't provide the accessors needed to map it as a component. You should consider implementing ! <tt>net.sf.hibernate.UserType</tt>. This approach frees the application code from implementing transformations to / from a Hibernate type. </p></dd><dt><span class="term">Use hand-coded JDBC in bottlenecks.</span></dt><dd><p> In performance-critical areas of the system, some kinds of operations (eg. mass update / ! delete) might benefit from direct JDBC. But please, wait until you <span class="emphasis"><i>know</i></span> something is a bottleneck. And don't assume that direct JDBC is necessarily faster. If need to ! use direct JDBC, it might be worth opening a Hibernate <tt>Session</tt> and using that SQL connection. That way you can still use the same transaction strategy and underlying connection provider. ! </p></dd><dt><span class="term">Understand <tt>Session</tt> flushing.</span></dt><dd><p> From time to time the Session synchronizes its persistent state with the database. Performance will be affected if this process occurs too often. You may sometimes minimize unnecessary flushing by disabling automatic flushing or even by changing the order of queries and other operations within a particular transaction. ! </p></dd><dt><span class="term">In a three tiered architecture, consider using <tt>saveOrUpdate()</tt>.</span></dt><dd><p> When using a servlet / session bean architecture, you could pass persistent objects loaded in the session bean to and from the servlet / JSP layer. Use a new session to service each request. ! Use <tt>Session.update()</tt> or <tt>Session.saveOrUpdate()</tt> to update the persistent state of an object. </p></dd><dt><span class="term">In a two tiered architecture, consider using session disconnection.</span></dt><dd><p> --- 27,53 ---- Hibernate lets the application manage JDBC connections. This approach should be considered a last-resort. If you can't use the built-in connections providers, consider providing your ! own implementation of <tt class="literal">net.sf.hibernate.connection.ConnectionProvider</tt>. </p></dd><dt><span class="term">Consider using a custom type.</span></dt><dd><p> Suppose you have a Java type, say from some library, that needs to be persisted but doesn't provide the accessors needed to map it as a component. You should consider implementing ! <tt class="literal">net.sf.hibernate.UserType</tt>. This approach frees the application code from implementing transformations to / from a Hibernate type. </p></dd><dt><span class="term">Use hand-coded JDBC in bottlenecks.</span></dt><dd><p> In performance-critical areas of the system, some kinds of operations (eg. mass update / ! delete) might benefit from direct JDBC. But please, wait until you <span class="emphasis"><em>know</em></span> something is a bottleneck. And don't assume that direct JDBC is necessarily faster. If need to ! use direct JDBC, it might be worth opening a Hibernate <tt class="literal">Session</tt> and using that SQL connection. That way you can still use the same transaction strategy and underlying connection provider. ! </p></dd><dt><span class="term">Understand <tt class="literal">Session</tt> flushing.</span></dt><dd><p> From time to time the Session synchronizes its persistent state with the database. Performance will be affected if this process occurs too often. You may sometimes minimize unnecessary flushing by disabling automatic flushing or even by changing the order of queries and other operations within a particular transaction. ! </p></dd><dt><span class="term">In a three tiered architecture, consider using <tt class="literal">saveOrUpdate()</tt>.</span></dt><dd><p> When using a servlet / session bean architecture, you could pass persistent objects loaded in the session bean to and from the servlet / JSP layer. Use a new session to service each request. ! Use <tt class="literal">Session.update()</tt> or <tt class="literal">Session.saveOrUpdate()</tt> to update the persistent state of an object. </p></dd><dt><span class="term">In a two tiered architecture, consider using session disconnection.</span></dt><dd><p> *************** *** 56,60 **** </p></dd><dt><span class="term">Don't treat exceptions as recoverable.</span></dt><dd><p> This is more of a necessary paractice than a "best" practice. When an exception occurs, roll back ! the <tt>Transaction</tt> and close the <tt>Session</tt>. If you don't, Hibernate can't guarantee that in-memory state accurately represents persistent state ! </p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="examples.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Chapter 9. Examples </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html> \ No newline at end of file --- 56,60 ---- </p></dd><dt><span class="term">Don't treat exceptions as recoverable.</span></dt><dd><p> This is more of a necessary paractice than a "best" practice. When an exception occurs, roll back ! the <tt class="literal">Transaction</tt> and close the <tt class="literal">Session</tt>. If you don't, Hibernate can't guarantee that in-memory state accurately represents persistent state ! </p></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="examples.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Chapter 9. Examples </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html> \ No newline at end of file Index: examples.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/examples.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** examples.html 28 Jan 2003 13:25:09 -0000 1.2 --- examples.html 23 Feb 2003 13:45:25 -0000 1.3 *************** *** 1,11 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 9. Examples</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.49"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="up" href="index.html" title="Hibernate Reference Documentation"><link rel="previous" href="transactions.html" title="Chapter 8. Transactions And Concurrency"><link rel="next" href="best-practices.html" title="Chapter 10. Best Practices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="transactions.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="best-practices.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="examples"></a>Chapter 9. Examples</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="examples.html#examples-s0">Employer / Employee</a></dt><dt><a href="examples.html#examples-s1">Author / Work</a></dt><dt><a href="examples.html#examples-s2">Customer / Order / Product</a></dt></dl></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="examples-s0"></a>Employer / Employee</h2></div></div><p> ! The following model of the relationship between <tt>Employer</tt> and ! <tt>Employee</tt> uses an actual entity class (<tt>Employment</tt>) to represent the association. This is done because there might be more than one period of employment for the same two parties. Components are used to model monetory values and employee names. ! </p><div class="mediaobject"><img src="../images/EmployerEmployee.gif" align="center"></div><p> Heres a possible mapping document: </p><pre class="programlisting"><hibernate-mapping> --- 1,11 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Chapter 9. Examples</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="up" href="index.html" title="HIBERNATE - Relational Persistence for Idiomatic Java"><link rel="previous" href="transactions.html" title="Chapter 8. Transactions And Concurrency"><link rel="next" href="best-practices.html" title="Chapter 10. Best Practices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="transactions.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="best-practices.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="examples"></a>Chapter 9. Examples</h2></div></div><div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="examples-s0"></a>9.1. Employer/Employee</h2></div></div><div></div></div><p> ! The following model of the relationship between <tt class="literal">Employer</tt> and ! <tt class="literal">Employee</tt> uses an actual entity class (<tt class="literal">Employment</tt>) to represent the association. This is done because there might be more than one period of employment for the same two parties. Components are used to model monetory values and employee names. ! </p><div class="mediaobject" align="center"><img src="../images/EmployerEmployee.gif" align="middle"></div><p> Heres a possible mapping document: </p><pre class="programlisting"><hibernate-mapping> *************** *** 57,61 **** </hibernate-mapping></pre><p> ! And heres the table schema generated by <tt>SchemaExport</tt>. </p><pre class="programlisting">create table employers ( id BIGINT not null, --- 57,61 ---- </hibernate-mapping></pre><p> ! And heres the table schema generated by <tt class="literal">SchemaExport</tt>. </p><pre class="programlisting">create table employers ( id BIGINT not null, *************** *** 84,99 **** ) ! alter table employment_periods add constraint employment_periodsFK0 foreign key (employer_id) references employers ! alter table employment_periods add constraint employment_periodsFK1 foreign key (employee_id) references employees create sequence employee_id_seq create sequence employment_id_seq ! create sequence employer_id_seq</pre></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="examples-s1"></a>Author / Work</h2></div></div><p> ! Consider the following model of the relationships between <tt>Work</tt>, ! <tt>Author</tt> and <tt>Person</tt>. We represent the relationship ! between <tt>Work</tt> and <tt>Author</tt> as a many-to-many ! association. We choose to represent the relationship between <tt>Author</tt> ! and <tt>Person</tt> as one-to-one association. Another possibility would be to ! have <tt>Author</tt> extend <tt>Person</tt>. ! </p><div class="mediaobject"><img src="../images/AuthorWork.gif" align="center"></div><p> The following mapping document correctly represents these relationships: </p><pre class="programlisting"><hibernate-mapping> --- 84,101 ---- ) ! alter table employment_periods ! add constraint employment_periodsFK0 foreign key (employer_id) references employers ! alter table employment_periods ! add constraint employment_periodsFK1 foreign key (employee_id) references employees create sequence employee_id_seq create sequence employment_id_seq ! create sequence employer_id_seq</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="examples-s1"></a>9.2. Author/Work</h2></div></div><div></div></div><p> ! Consider the following model of the relationships between <tt class="literal">Work</tt>, ! <tt class="literal">Author</tt> and <tt class="literal">Person</tt>. We represent the relationship ! between <tt class="literal">Work</tt> and <tt class="literal">Author</tt> as a many-to-many ! association. We choose to represent the relationship between <tt class="literal">Author</tt> ! and <tt class="literal">Person</tt> as one-to-one association. Another possibility would be to ! have <tt class="literal">Author</tt> extend <tt class="literal">Person</tt>. ! </p><div class="mediaobject" align="center"><img src="../images/AuthorWork.gif" align="middle"></div><p> The following mapping document correctly represents these relationships: </p><pre class="programlisting"><hibernate-mapping> *************** *** 126,130 **** <id name="id" column="id"> ! <generator class="assigned"/> <!-- The Author must have the same identifier as the Person --> </id> --- 128,133 ---- <id name="id" column="id"> ! <!-- The Author must have the same identifier as the Person --> ! <generator class="assigned"/> </id> *************** *** 147,155 **** </hibernate-mapping></pre><p> ! There are four tables in this mapping. <tt>works</tt>, ! <tt>authors</tt> and <tt>persons</tt> hold work, author ! and person data respectively. <tt>author_work</tt> is an association table linking authors to works. Heres the table schema, as generated by ! <tt>SchemaExport</tt>. </p><pre class="programlisting">create table works ( id BIGINT not null generated by default as identity, --- 150,158 ---- </hibernate-mapping></pre><p> ! There are four tables in this mapping. <tt class="literal">works</tt>, ! <tt class="literal">authors</tt> and <tt class="literal">persons</tt> hold work, author ! and person data respectively. <tt class="literal">author_work</tt> is an association table linking authors to works. Heres the table schema, as generated by ! <tt class="literal">SchemaExport</tt>. </p><pre class="programlisting">create table works ( id BIGINT not null generated by default as identity, *************** *** 180,195 **** ) ! alter table authors add constraint authorsFK0 foreign key (id) references persons ! alter table author_work add constraint author_workFK0 foreign key (author_id) references authors ! alter table author_work add constraint author_workFK1 foreign key (work_id) references works</pre></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="examples-s2"></a>Customer / Order / Product</h2></div></div><p> ! Now consider a model of the relationships between <tt>Customer</tt>, ! <tt>Order</tt> and <tt>LineItem</tt> and <tt>Product</tt>. ! There is a one-to-many association between <tt>Customer</tt> and ! <tt>Order</tt>, but how should we represent <tt>Order</tt> / ! <tt>LineItem</tt> / <tt>Product</tt>? I've chosen to map ! <tt>LineItem</tt> as an association class representing the many-to-many ! association between <tt>Order</tt> and <tt>Product</tt>. In Hibernate, this is called a composite element. ! </p><div class="mediaobject"><img src="../images/CustomerOrderProduct.gif" align="center"></div><p> The mapping document: </p><pre class="programlisting"><hibernate-mapping> --- 183,201 ---- ) ! alter table authors ! add constraint authorsFK0 foreign key (id) references persons ! alter table author_work ! add constraint author_workFK0 foreign key (author_id) references authors ! alter table author_work ! add constraint author_workFK1 foreign key (work_id) references works</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="examples-s2"></a>9.3. Customer/Order/Product</h2></div></div><div></div></div><p> ! Now consider a model of the relationships between <tt class="literal">Customer</tt>, ! <tt class="literal">Order</tt> and <tt class="literal">LineItem</tt> and <tt class="literal">Product</tt>. ! There is a one-to-many association between <tt class="literal">Customer</tt> and ! <tt class="literal">Order</tt>, but how should we represent <tt class="literal">Order</tt> / ! <tt class="literal">LineItem</tt> / <tt class="literal">Product</tt>? I've chosen to map ! <tt class="literal">LineItem</tt> as an association class representing the many-to-many ! association between <tt class="literal">Order</tt> and <tt class="literal">Product</tt>. In Hibernate, this is called a composite element. ! </p><div class="mediaobject" align="center"><img src="../images/AuthorWork.gif" align="middle"></div><p> The mapping document: </p><pre class="programlisting"><hibernate-mapping> *************** *** 230,236 **** </hibernate-mapping></pre><p> ! <tt>customers</tt>, <tt>orders</tt>, <tt>line_items</tt> and ! <tt>products</tt> hold customer, order, order line item and product data ! respectively. <tt>line_items</tt> also acts as an association table linking orders with products. </p><pre class="programlisting">create table customers ( --- 236,242 ---- </hibernate-mapping></pre><p> ! <tt class="literal">customers</tt>, <tt class="literal">orders</tt>, <tt class="literal">line_items</tt> and ! <tt class="literal">products</tt> hold customer, order, order line item and product data ! respectively. <tt class="literal">line_items</tt> also acts as an association table linking orders with products. </p><pre class="programlisting">create table customers ( *************** *** 261,265 **** ) ! alter table orders add constraint ordersFK0 foreign key (customer_id) references customers ! alter table line_items add constraint line_itemsFK0 foreign key (product_id) references products ! alter table line_items add constraint line_itemsFK1 foreign key (order_id) references orders</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="transactions.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="best-practices.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Transactions And Concurrency </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Best Practices</td></tr></table></div></body></html> \ No newline at end of file --- 267,274 ---- ) ! alter table orders ! add constraint ordersFK0 foreign key (customer_id) references customers ! alter table line_items ! add constraint line_itemsFK0 foreign key (product_id) references products ! alter table line_items ! add constraint line_itemsFK1 foreign key (order_id) references orders</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="transactions.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="best-practices.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Transactions And Concurrency </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Best Practices</td></tr></table></div></body></html> \ No newline at end of file Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/index.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.html 28 Jan 2003 13:25:09 -0000 1.2 --- index.html 23 Feb 2003 13:45:25 -0000 1.3 *************** *** 1,3 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>Hibernate Reference Documentation</title><link rel="stylesheet" href="../style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.49"><link rel="home" href="index.html" title="Hibernate Reference Documentation"><link rel="next" href="architecture.html" title="Chapter 1. Architecture"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Hibernate Reference Documentation</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr></table><hr></div><div class="book"><div class="titlepage"><div><h1 class="title"><a name="d0e1"></a>Hibernate Reference Documentation</h1></div><div><h2 class="subtitle">Relational Persistence for Idiomatic Java</h2></div><div><h2 class="subtitle">http://hibernate.sourceforge.net/</h2></div><div><h2 class="subtitle">Version: 2.0 beta1</h2></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="architecture.html">Architecture</a></dt><dd><dl><dt><a href="architecture.html#architecture-s1">Overview</a></dt><dt><a href="architecture.html#architecture-s2">Persistent Object Identity</a></dt><dt><a href="architecture.html#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="session-configuration.html">SessionFactory Configuration</a></dt><dd><dl><dt><a href="session-configuration.html#session-configuration-s1">Programmatic Configuration</a></dt><dt><a href="session-configuration.html#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt><a href="session-configuration.html#session-configuration-s3">User provided JDBC connection</a></dt><dt><a href="session-configuration.html#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt><a href="session-configuration.html#session-configuration-s5">Other properties</a></dt><dt><a href="session-configuration.html#session-configuration-s6">XML Configuration File</a></dt><dt><a href="session-configuration.html#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="persistent-classes.html">Persistent Classes</a></dt><dd><dl><dt><a href="persistent-classes.html#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt><a href="persistent-classes.html#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt><a href="persistent-classes.html#persistent-classes-s1-2">Implement a default constructor</a></dt><dt><a href="persistent-classes.html#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt><a href="persistent-classes.html#persistent-classes-s2">Inheritance</a></dt><dt><a href="persistent-classes.html#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt><a href="persistent-classes.html#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="or-mapping.html">Basic O/R Mapping</a></dt><dd><dl><dt><a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt><a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt><a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt><a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt><a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt><a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt><a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt><a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt><a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt><a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt><a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt><a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt><a href="or-mapping.html#or-mapping-s1-10">component, dynabean</a></dt><dt><a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt><a href="or-mapping.html#or-mapping-s1-11b">joined-subclass</a></dt><dt><a href="or-mapping.html#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt><a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt><a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt><a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt><a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt><a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt><a href="or-mapping.html#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></dd><dt>5. <a href="adv-or-mapping.html">Advanced O/R Mapping</a></dt><dd><dl><dt><a href="adv-or-mapping.html#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-1">Persistent Collections</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt><a href="adv-or-mapping.html#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt><a href="adv-or-mapping... [truncated message content] |