From: <tu...@us...> - 2003-02-23 13:45:30
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/html_single In directory sc8-pr-cvs1:/tmp/cvs-serv13704/doc/reference/html_single Modified Files: index.html Log Message: Updated Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html_single/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 2 Feb 2003 07:02:31 -0000 1.3 --- index.html 23 Feb 2003 13:45:24 -0000 1.4 *************** *** 1,7 **** <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: ! </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"> [...5521 lines suppressed...] 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> *************** *** 3312,3317 **** remember to disconnect the session before returning control to the client. </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></body></html> --- 3418,3423 ---- remember to disconnect the session before returning control to the client. </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></body></html> |