From: <tu...@us...> - 2003-01-28 13:25:13
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/html_single In directory sc8-pr-cvs1:/tmp/cvs-serv4176/html_single Modified Files: index.html Log Message: Updated doco Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html_single/index.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** index.html 1 Jan 2003 13:43:51 -0000 1.1.1.1 --- index.html 28 Jan 2003 13:25:10 -0000 1.2 *************** *** 1,5 **** <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"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><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><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>1. <a href="#architecture">Architecture</a></dt><dd><dl><dt><a href="#architecture-s1">Overview</a></dt><dt><a href="#architecture-s2">Persistent Object Identity</a></dt><dt><a href="#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="#session-configuration">SessionFactory Configuration</a></dt><dd><dl><dt><a href="#session-configuration-s1">Programmatic Datastore Configuration</a></dt><dt><a href="#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt><a href="#session-configuration-s3">User provided JDBC connection</a></dt><dt><a href="#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt><a href="#session-configuration-s5">Other properties</a></dt><dt><a href="#session-configuration-s6">XML Configuration File</a></dt><dt><a href="#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="#persistent-classes">Persistent Classes</a></dt><dd><dl><dt><a href="#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt><a href="#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt><a href="#persistent-classes-s1-2">Implement a default constructor</a></dt><dt><a href="#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt><a href="#persistent-classes-s2">Inheritance</a></dt><dt><a href="#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt><a href="#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="#or-mapping">Basic O/R Mapping</a></dt><dd><dl><dt><a href="#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt><a href="#or-mapping-s1-1">Doctype</a></dt><dt><a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt><a href="#or-mapping-s1-3">class</a></dt><dt><a href="#or-mapping-s1-4">id</a></dt><dt><a href="#or-mapping-s1-4b">composite-id</a></dt><dt><a href="#or-mapping-s1-5">discriminator</a></dt><dt><a href="#or-mapping-s1-6">version (optional)</a></dt><dt><a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt><a href="#or-mapping-s1-7">property</a></dt><dt><a href="#or-mapping-s1-8">many-to-one</a></dt><dt><a href="#or-mapping-s1-9">one-to-one</a></dt><dt><a href="#or-mapping-s1-10">component</a></dt><dt><a href="#or-mapping-s1-11">subclass</a></dt><dt><a href="#or-mapping-s1-11b">joined-subclass</a></dt><dt><a href="#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt><a href="#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt><a href="#or-mapping-s2-1">Entities and values</a></dt><dt><a href="#or-mapping-s2-2">Basic value types</a></dt><dt><a href="#or-mapping-s2-3">Persistent enum types</a></dt><dt><a href="#or-mapping-s2-4">Custom value types</a></dt><dt><a href="#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></dd><dt>5. <a href="#adv-or-mapping">Advanced O/R Mapping</a></dt><dd><dl><dt><a href="#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt><a href="#adv-or-mapping-s1-1">Persistent Collection Styles</a></dt><dt><a href="#adv-or-mapping-s1-2">Toplevel and Nested Collections</a></dt><dt><a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt><a href="#adv-or-mapping-s1-4">Mapping a Property to a Toplevel Collection</a></dt><dt><a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt><a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt><a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt><a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt><a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt><a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt><a href="#adv-or-mapping-s1-11">Ternary Associations</a></dt><dt><a href="#adv-or-mapping-s1-12">Collection Example</a></dt></dl></dd><dt><a href="#adv-or-mapping-s2">Components</a></dt><dd><dl><dt><a href="#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt><a href="#adv-or-mapping-s2-2">In Collections</a></dt><dt><a href="#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt><a href="#adv-or-mapping-s2-3">As Composite Identifiers</a></dt></dl></dd><dt><a href="#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt><a href="#adv-or-mapping-s3-1">Mapping</a></dt><dt><a href="#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt><a href="#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt><a href="#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="#manipulating-data">Manipulating Persistent Data</a></dt><dd><dl><dt><a href="#manipulating-data-s1">Creating a persistent object</a></dt><dt><a href="#manipulating-data-s2">Loading an object</a></dt><dt><a href="#manipulating-data-s3">Querying</a></dt><dd><dl><dt><a href="#manipulating-data-s4">Scalar queries</a></dt><dt><a href="#manipulating-data-s5">The Query interface</a></dt><dt><a href="#manipulating-data-s5b">Scrollable iteration</a></dt><dt><a href="#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt><a href="#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt><a href="#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt><a href="#manipulating-data-s9">Deleting persistent objects</a></dt><dt><a href="#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt><a href="#manipulating-data-s11a">Lifecycle objects</a></dt><dt><a href="#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt><a href="#manipulating-data-s12">Flushing</a></dt><dt><a href="#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt><a href="#manipulating-data-s13-1">Flushing the session</a></dt><dt><a href="#manipulating-data-s13-2">Committing the transaction</a></dt><dt><a href="#manipulating-data-s13-3">Closing the session</a></dt><dt><a href="#manipulating-data-s13-4">Exception handling</a></dt></dl></dd><dt><a href="#manipulating-data-s14">Interceptors</a></dt></dl></dd><dt>7. <a href="#query-language">Hibernate Query Language</a></dt><dd><dl><dt><a href="#query-language-s1">Case Sensitivity</a></dt><dt><a href="#query-language-s2">The from clause</a></dt><dt><a href="#query-language-s3">The select clause</a></dt><dt><a href="#query-language-s3b">polymorphism</a></dt><dt><a href="#query-language-s4">from collections</a></dt><dt><a href="#query-language-s5">The where clause</a></dt><dt><a href="#query-language-s6">Expressions</a></dt><dt><a href="#query-language-s7">The order by clause</a></dt><dt><a href="#query-language-s8">The group by clause</a></dt><dt><a href="#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="#transactions">Transactions And Concurrency</a></dt><dd><dl><dt><a href="#transactions-s1">Datastores, Sessions and Factories</a></dt><dt><a href="#transactions-s2">Threads and connections</a></dt><dt><a href="#transactions-s3">Optimistic Locking / Versioning</a></dt><dd><dl><dt><a href="#transactions-s3-1">Long session with automatic versioning</a></dt><dt><a href="#transactions-s3-2">Many sessions with automatic versioning</a></dt><dt><a href="#transactions-s3-3">Application version checking</a></dt></dl></dd><dt><a href="#transactions-s4">Session disconnection</a></dt><dt><a href="#transactions-s5">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="#examples">Examples</a></dt><dd><dl><dt><a href="#examples-s0">Employer / Employee</a></dt><dt><a href="#examples-s1">Author / Work</a></dt><dt><a href="#examples-s2">Customer / Order / Product</a></dt></dl></dd><dt>10. <a href="#best-practices">Best Practices</a></dt></dl></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-s1">Overview</a></dt><dt><a href="#architecture-s2">Persistent Object Identity</a></dt><dt><a href="#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> --- 1,5 ---- <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"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><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">Architecture</a></dt><dd><dl><dt><a href="#architecture-s1">Overview</a></dt><dt><a href="#architecture-s2">Persistent Object Identity</a></dt><dt><a href="#architecture-s3">JMX Integration</a></dt></dl></dd><dt>2. <a href="#session-configuration">SessionFactory Configuration</a></dt><dd><dl><dt><a href="#session-configuration-s1">Programmatic Configuration</a></dt><dt><a href="#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt><a href="#session-configuration-s3">User provided JDBC connection</a></dt><dt><a href="#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt><a href="#session-configuration-s5">Other properties</a></dt><dt><a href="#session-configuration-s6">XML Configuration File</a></dt><dt><a href="#session-configuration-s7">Logging</a></dt></dl></dd><dt>3. <a href="#persistent-classes">Persistent Classes</a></dt><dd><dl><dt><a href="#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt><a href="#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt><a href="#persistent-classes-s1-2">Implement a default constructor</a></dt><dt><a href="#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt><a href="#persistent-classes-s2">Inheritance</a></dt><dt><a href="#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt><a href="#persistent-classes-s4">Validatable</a></dt></dl></dd><dt>4. <a href="#or-mapping">Basic O/R Mapping</a></dt><dd><dl><dt><a href="#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt><a href="#or-mapping-s1-1">Doctype</a></dt><dt><a href="#or-mapping-s1-2">hibernate-mapping</a></dt><dt><a href="#or-mapping-s1-3">class</a></dt><dt><a href="#or-mapping-s1-4">id</a></dt><dt><a href="#or-mapping-s1-4b">composite-id</a></dt><dt><a href="#or-mapping-s1-5">discriminator</a></dt><dt><a href="#or-mapping-s1-6">version (optional)</a></dt><dt><a href="#or-mapping-s1-6b">timestamp (optional)</a></dt><dt><a href="#or-mapping-s1-7">property</a></dt><dt><a href="#or-mapping-s1-8">many-to-one</a></dt><dt><a href="#or-mapping-s1-9">one-to-one</a></dt><dt><a href="#or-mapping-s1-10">component, dynabean</a></dt><dt><a href="#or-mapping-s1-11">subclass</a></dt><dt><a href="#or-mapping-s1-11b">joined-subclass</a></dt><dt><a href="#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt><a href="#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt><a href="#or-mapping-s2-1">Entities and values</a></dt><dt><a href="#or-mapping-s2-2">Basic value types</a></dt><dt><a href="#or-mapping-s2-3">Persistent enum types</a></dt><dt><a href="#or-mapping-s2-4">Custom value types</a></dt><dt><a href="#or-mapping-s2-5">The object type</a></dt></dl></dd></dl></dd><dt>5. <a href="#adv-or-mapping">Advanced O/R Mapping</a></dt><dd><dl><dt><a href="#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt><a href="#adv-or-mapping-s1-1">Persistent Collections</a></dt><dt><a href="#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt><a href="#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt><a href="#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt><a href="#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt><a href="#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt><a href="#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt><a href="#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt><a href="#adv-or-mapping-s1-11">Ternary Associations</a></dt><dt><a href="#adv-or-mapping-s1-12">Collection Example</a></dt></dl></dd><dt><a href="#adv-or-mapping-s2">Components</a></dt><dd><dl><dt><a href="#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt><a href="#adv-or-mapping-s2-2">In Collections</a></dt><dt><a href="#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt><a href="#adv-or-mapping-s2-3">As Composite Identifiers</a></dt><dt><a href="#adv-or-mapping-s2-4">Dynabean components</a></dt></dl></dd><dt><a href="#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt><a href="#adv-or-mapping-s3-1">Mapping</a></dt><dt><a href="#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt><a href="#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt><a href="#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="#manipulating-data">Manipulating Persistent Data</a></dt><dd><dl><dt><a href="#manipulating-data-s1">Creating a persistent object</a></dt><dt><a href="#manipulating-data-s2">Loading an object</a></dt><dt><a href="#manipulating-data-s3">Querying</a></dt><dd><dl><dt><a href="#manipulating-data-s4">Scalar queries</a></dt><dt><a href="#manipulating-data-s5">The Query interface</a></dt><dt><a href="#manipulating-data-s5b">Scrollable iteration</a></dt><dt><a href="#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt><a href="#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt><a href="#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt><a href="#manipulating-data-s9">Deleting persistent objects</a></dt><dt><a href="#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt><a href="#manipulating-data-s11a">Lifecycle objects</a></dt><dt><a href="#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt><a href="#manipulating-data-s12">Flushing</a></dt><dt><a href="#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt><a href="#manipulating-data-s13-1">Flushing the session</a></dt><dt><a href="#manipulating-data-s13-2">Committing the transaction</a></dt><dt><a href="#manipulating-data-s13-3">Closing the session</a></dt><dt><a href="#manipulating-data-s13-4">Exception handling</a></dt></dl></dd><dt><a href="#manipulating-data-s14">Interceptors</a></dt></dl></dd><dt>7. <a href="#query-language">Hibernate Query Language</a></dt><dd><dl><dt><a href="#query-language-s1">Case Sensitivity</a></dt><dt><a href="#query-language-s2">The from clause</a></dt><dt><a href="#query-language-s3">The select clause</a></dt><dt><a href="#query-language-s3b">polymorphism</a></dt><dt><a href="#query-language-s4">from collections</a></dt><dt><a href="#query-language-s5">The where clause</a></dt><dt><a href="#query-language-s6">Expressions</a></dt><dt><a href="#query-language-s7">The order by clause</a></dt><dt><a href="#query-language-s8">The group by clause</a></dt><dt><a href="#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="#transactions">Transactions And Concurrency</a></dt><dd><dl><dt><a href="#transactions-s1">Configurations, Sessions and Factories</a></dt><dt><a href="#transactions-s2">Threads and connections</a></dt><dt><a href="#transactions-s3">Optimistic Locking / Versioning</a></dt><dd><dl><dt><a href="#transactions-s3-1">Long session with automatic versioning</a></dt><dt><a href="#transactions-s3-2">Many sessions with automatic versioning</a></dt><dt><a href="#transactions-s3-3">Application version checking</a></dt></dl></dd><dt><a href="#transactions-s4">Session disconnection</a></dt><dt><a href="#transactions-s5">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="#examples">Examples</a></dt><dd><dl><dt><a href="#examples-s0">Employer / Employee</a></dt><dt><a href="#examples-s1">Author / Work</a></dt><dt><a href="#examples-s2">Customer / Order / Product</a></dt></dl></dd><dt>10. <a href="#best-practices">Best Practices</a></dt></dl></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-s1">Overview</a></dt><dt><a href="#architecture-s2">Persistent Object Identity</a></dt><dt><a href="#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: [...1697 lines suppressed...] a last-resort. If you can't use the built-in connections providers, consider providing your ! own implementation of <tt>cirrus.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>cirrus.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> --- 3284,3293 ---- 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> |