From: <tu...@us...> - 2003-03-02 13:59:05
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/html In directory sc8-pr-cvs1:/tmp/cvs-serv23405/doc/reference/html Modified Files: index.html query-language.html Log Message: Version Update for Release Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 23 Feb 2003 13:45:25 -0000 1.3 --- index.html 2 Mar 2003 13:59:02 -0000 1.4 *************** *** 1,3 **** <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>HIBERNATE - Relational Persistence for Idiomatic Java</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="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 - Relational Persistence for Idiomatic Java</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" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="d0e1"></a>HIBERNATE - Relational Persistence for Idiomatic Java</h1></div><div><h2 class="subtitle">Reference Documentation</h2></div><div><p class="releaseinfo">2.0 beta2</p></div></div><div></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>1.1. <a href="architecture.html#architecture-s1">Overview</a></dt><dt>1.2. <a href="architecture.html#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <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>2.1. <a href="session-configuration.html#session-configuration-s1">Programmatic Configuration</a></dt><dt>2.2. <a href="session-configuration.html#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt>2.3. <a href="session-configuration.html#session-configuration-s3">User provided JDBC connection</a></dt><dt>2.4. <a href="session-configuration.html#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt>2.5. <a href="session-configuration.html#session-configuration-s5">Other properties</a></dt><dt>2.6. <a href="session-configuration.html#session-configuration-s6">XML Configuration File</a></dt><dt>2.7. <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>3.1. <a href="persistent-classes.html#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt>3.1.1. <a href="persistent-classes.html#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt>3.1.2. <a href="persistent-classes.html#persistent-classes-s1-2">Implement a default constructor</a></dt><dt>3.1.3. <a href="persistent-classes.html#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt>3.2. <a href="persistent-classes.html#persistent-classes-s2">Inheritance</a></dt><dt>3.3. <a href="persistent-classes.html#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt>3.4. <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>4.1. <a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component, dynabean</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="or-mapping.html#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt>4.2. <a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <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>5.1. <a href="adv-or-mapping.html#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="adv-or-mapping.html#adv-or-mapping-s1-1">Persistent Collections</a></dt><dt>5.1.2. <a href="adv-or-mapping.html#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.3. <a href="adv-or-mapping.html#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.4. <a href="adv-or-mapping.html#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.5. <a href="adv-or-mapping.html#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.6. <a href="adv-or-mapping.html#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.7. <a href="adv-or-mapping.html#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.8. <a href="adv-or-mapping.html#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.9. <a href="adv-or-mapping.html#adv-or-mapping-s1-11">Ternary Associations</a></dt><dt>5.1.10. <a href="adv-or-mapping.html#adv-or-mapping-s1-12">Collection Example</a></dt></dl></dd><dt>5.2. <a href="adv-or-mapping.html#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="adv-or-mapping.html#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="adv-or-mapping.html#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="adv-or-mapping.html#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="adv-or-mapping.html#adv-or-mapping-s2-3">As Composite Identifiers</a></dt><dt>5.2.5. <a href="adv-or-mapping.html#adv-or-mapping-s2-4">Dynabean components</a></dt></dl></dd><dt>5.3. <a href="adv-or-mapping.html#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="adv-or-mapping.html#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="adv-or-mapping.html#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="adv-or-mapping.html#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="adv-or-mapping.html#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="manipulating-data.html">Manipulating Persistent Data</a></dt><dd><dl><dt>6.1. <a href="manipulating-data.html#manipulating-data-s1">Creating a persistent object</a></dt><dt>6.2. <a href="manipulating-data.html#manipulating-data-s2">Loading an object</a></dt><dt>6.3. <a href="manipulating-data.html#manipulating-data-s3">Querying</a></dt><dd><dl><dt>6.3.1. <a href="manipulating-data.html#manipulating-data-s4">Scalar queries</a></dt><dt>6.3.2. <a href="manipulating-data.html#manipulating-data-s5">The Query interface</a></dt><dt>6.3.3. <a href="manipulating-data.html#manipulating-data-s5b">Scrollable iteration</a></dt><dt>6.3.4. <a href="manipulating-data.html#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt>6.4. <a href="manipulating-data.html#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt>6.5. <a href="manipulating-data.html#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt>6.6. <a href="manipulating-data.html#manipulating-data-s9">Deleting persistent objects</a></dt><dt>6.7. <a href="manipulating-data.html#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt>6.7.1. <a href="manipulating-data.html#manipulating-data-s11a">Lifecycle objects</a></dt><dt>6.7.2. <a href="manipulating-data.html#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt>6.8. <a href="manipulating-data.html#manipulating-data-s12">Flushing</a></dt><dt>6.9. <a href="manipulating-data.html#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt>6.9.1. <a href="manipulating-data.html#manipulating-data-s13-1">Flushing the session</a></dt><dt>6.9.2. <a href="manipulating-data.html#manipulating-data-s13-2">Committing the transaction</a></dt><dt>6.9.3. <a href="manipulating-data.html#manipulating-data-s13-3">Closing the session</a></dt><dt>6.9.4. <a href="manipulating-data.html#manipulating-data-s13-4">Exception handling</a></dt></dl></dd><dt>6.10. <a href="manipulating-data.html#manipulating-data-s14">Interceptors</a></dt></dl></dd><dt>7. <a href="query-language.html">Hibernate Query Language</a></dt><dd><dl><dt>7.1. <a href="query-language.html#query-language-s1">Case Sensitivity</a></dt><dt>7.2. <a href="query-language.html#query-language-s2">The from clause</a></dt><dt>7.3. <a href="query-language.html#query-language-s3">The select clause</a></dt><dt>7.4. <a href="query-language.html#query-language-s3b">polymorphism</a></dt><dt>7.5. <a href="query-language.html#query-language-s4">from collections</a></dt><dt>7.6. <a href="query-language.html#query-language-s5">The where clause</a></dt><dt>7.7. <a href="query-language.html#query-language-s6">Expressions</a></dt><dt>7.8. <a href="query-language.html#query-language-s7">The order by clause</a></dt><dt>7.9. <a href="query-language.html#query-language-s8">The group by clause</a></dt><dt>7.10. <a href="query-language.html#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="transactions.html">Transactions And Concurrency</a></dt><dd><dl><dt>8.1. <a href="transactions.html#transactions-s1">Configurations, Sessions and Factories</a></dt><dt>8.2. <a href="transactions.html#transactions-s2">Threads and connections</a></dt><dt>8.3. <a href="transactions.html#transactions-s3">Optimistic Locking / Versioning</a></dt><dd><dl><dt>8.3.1. <a href="transactions.html#transactions-s3-1">Long session with automatic versioning</a></dt><dt>8.3.2. <a href="transactions.html#transactions-s3-2">Many sessions with automatic versioning</a></dt><dt>8.3.3. <a href="transactions.html#transactions-s3-3">Application version checking</a></dt></dl></dd><dt>8.4. <a href="transactions.html#transactions-s4">Session disconnection</a></dt><dt>8.5. <a href="transactions.html#transactions-s5">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="examples.html">Examples</a></dt><dd><dl><dt>9.1. <a href="examples.html#examples-s0">Employer/Employee</a></dt><dt>9.2. <a href="examples.html#examples-s1">Author/Work</a></dt><dt>9.3. <a href="examples.html#examples-s2">Customer/Order/Product</a></dt></dl></dd><dt>10. <a href="best-practices.html">Best Practices</a></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Architecture</td></tr></table></div></body></html> \ No newline at end of file --- 1,3 ---- <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> ! <title>HIBERNATE - Relational Persistence for Idiomatic Java</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="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 - Relational Persistence for Idiomatic Java</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" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="d0e1"></a>HIBERNATE - Relational Persistence for Idiomatic Java</h1></div><div><h2 class="subtitle">Reference Documentation</h2></div><div><p class="releaseinfo">2.0 beta4</p></div></div><div></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>1.1. <a href="architecture.html#architecture-s1">Overview</a></dt><dt>1.2. <a href="architecture.html#architecture-s2">Persistent Object Identity</a></dt><dt>1.3. <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>2.1. <a href="session-configuration.html#session-configuration-s1">Programmatic Configuration</a></dt><dt>2.2. <a href="session-configuration.html#session-configuration-s2">Obtaining a SessionFactory</a></dt><dt>2.3. <a href="session-configuration.html#session-configuration-s3">User provided JDBC connection</a></dt><dt>2.4. <a href="session-configuration.html#session-configuration-s4">Hibernate provided JDBC connection</a></dt><dt>2.5. <a href="session-configuration.html#session-configuration-s5">Other properties</a></dt><dt>2.6. <a href="session-configuration.html#session-configuration-s6">XML Configuration File</a></dt><dt>2.7. <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>3.1. <a href="persistent-classes.html#persistent-classes-s1">Simple Example</a></dt><dd><dl><dt>3.1.1. <a href="persistent-classes.html#persistent-classes-s1-1">Declare accessors and mutators for persistent fields</a></dt><dt>3.1.2. <a href="persistent-classes.html#persistent-classes-s1-2">Implement a default constructor</a></dt><dt>3.1.3. <a href="persistent-classes.html#persistent-classes-s1-3">Provide an identifier property (optional)</a></dt></dl></dd><dt>3.2. <a href="persistent-classes.html#persistent-classes-s2">Inheritance</a></dt><dt>3.3. <a href="persistent-classes.html#persistent-classes-s3">Persistent Lifecycle Callbacks</a></dt><dt>3.4. <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>4.1. <a href="or-mapping.html#or-mapping-s1">Mapping declaration</a></dt><dd><dl><dt>4.1.1. <a href="or-mapping.html#or-mapping-s1-1">Doctype</a></dt><dt>4.1.2. <a href="or-mapping.html#or-mapping-s1-2">hibernate-mapping</a></dt><dt>4.1.3. <a href="or-mapping.html#or-mapping-s1-3">class</a></dt><dt>4.1.4. <a href="or-mapping.html#or-mapping-s1-4">id</a></dt><dt>4.1.5. <a href="or-mapping.html#or-mapping-s1-4b">composite-id</a></dt><dt>4.1.6. <a href="or-mapping.html#or-mapping-s1-5">discriminator</a></dt><dt>4.1.7. <a href="or-mapping.html#or-mapping-s1-6">version (optional)</a></dt><dt>4.1.8. <a href="or-mapping.html#or-mapping-s1-6b">timestamp (optional)</a></dt><dt>4.1.9. <a href="or-mapping.html#or-mapping-s1-7">property</a></dt><dt>4.1.10. <a href="or-mapping.html#or-mapping-s1-8">many-to-one</a></dt><dt>4.1.11. <a href="or-mapping.html#or-mapping-s1-9">one-to-one</a></dt><dt>4.1.12. <a href="or-mapping.html#or-mapping-s1-10">component, dynabean</a></dt><dt>4.1.13. <a href="or-mapping.html#or-mapping-s1-11">subclass</a></dt><dt>4.1.14. <a href="or-mapping.html#or-mapping-s1-11b">joined-subclass</a></dt><dt>4.1.15. <a href="or-mapping.html#or-mapping-s1-12">map, set, list, bag</a></dt></dl></dd><dt>4.2. <a href="or-mapping.html#or-mapping-s2">Hibernate Types</a></dt><dd><dl><dt>4.2.1. <a href="or-mapping.html#or-mapping-s2-1">Entities and values</a></dt><dt>4.2.2. <a href="or-mapping.html#or-mapping-s2-2">Basic value types</a></dt><dt>4.2.3. <a href="or-mapping.html#or-mapping-s2-3">Persistent enum types</a></dt><dt>4.2.4. <a href="or-mapping.html#or-mapping-s2-4">Custom value types</a></dt><dt>4.2.5. <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>5.1. <a href="adv-or-mapping.html#adv-or-mapping-s1">Collections</a></dt><dd><dl><dt>5.1.1. <a href="adv-or-mapping.html#adv-or-mapping-s1-1">Persistent Collections</a></dt><dt>5.1.2. <a href="adv-or-mapping.html#adv-or-mapping-s1-3">Mapping a Collection</a></dt><dt>5.1.3. <a href="adv-or-mapping.html#adv-or-mapping-s1-5">Collections of Values and Many To Many Associations</a></dt><dt>5.1.4. <a href="adv-or-mapping.html#adv-or-mapping-s1-6">One To Many Associations</a></dt><dt>5.1.5. <a href="adv-or-mapping.html#adv-or-mapping-s1-7">Lazy Initialization</a></dt><dt>5.1.6. <a href="adv-or-mapping.html#adv-or-mapping-s1-8">Sorted Collections</a></dt><dt>5.1.7. <a href="adv-or-mapping.html#adv-or-mapping-s1-9">Garbage Collection</a></dt><dt>5.1.8. <a href="adv-or-mapping.html#adv-or-mapping-s1-10">Bidirectional Associations</a></dt><dt>5.1.9. <a href="adv-or-mapping.html#adv-or-mapping-s1-11">Ternary Associations</a></dt><dt>5.1.10. <a href="adv-or-mapping.html#adv-or-mapping-s1-12">Collection Example</a></dt></dl></dd><dt>5.2. <a href="adv-or-mapping.html#adv-or-mapping-s2">Components</a></dt><dd><dl><dt>5.2.1. <a href="adv-or-mapping.html#adv-or-mapping-s2-1">As Dependent Objects</a></dt><dt>5.2.2. <a href="adv-or-mapping.html#adv-or-mapping-s2-2">In Collections</a></dt><dt>5.2.3. <a href="adv-or-mapping.html#adv-or-mapping-s2-2b">As a Map Index</a></dt><dt>5.2.4. <a href="adv-or-mapping.html#adv-or-mapping-s2-3">As Composite Identifiers</a></dt><dt>5.2.5. <a href="adv-or-mapping.html#adv-or-mapping-s2-4">Dynabean components</a></dt></dl></dd><dt>5.3. <a href="adv-or-mapping.html#adv-or-mapping-s3">Cache</a></dt><dd><dl><dt>5.3.1. <a href="adv-or-mapping.html#adv-or-mapping-s3-1">Mapping</a></dt><dt>5.3.2. <a href="adv-or-mapping.html#adv-or-mapping-s3-2">Read Only Cache</a></dt><dt>5.3.3. <a href="adv-or-mapping.html#adv-or-mapping-s3-3">Read / Write Cache</a></dt></dl></dd><dt>5.4. <a href="adv-or-mapping.html#adv-or-mapping-s4">Proxies for Lazy Initialization</a></dt></dl></dd><dt>6. <a href="manipulating-data.html">Manipulating Persistent Data</a></dt><dd><dl><dt>6.1. <a href="manipulating-data.html#manipulating-data-s1">Creating a persistent object</a></dt><dt>6.2. <a href="manipulating-data.html#manipulating-data-s2">Loading an object</a></dt><dt>6.3. <a href="manipulating-data.html#manipulating-data-s3">Querying</a></dt><dd><dl><dt>6.3.1. <a href="manipulating-data.html#manipulating-data-s4">Scalar queries</a></dt><dt>6.3.2. <a href="manipulating-data.html#manipulating-data-s5">The Query interface</a></dt><dt>6.3.3. <a href="manipulating-data.html#manipulating-data-s5b">Scrollable iteration</a></dt><dt>6.3.4. <a href="manipulating-data.html#manipulating-data-s6">Filtering collections</a></dt></dl></dd><dt>6.4. <a href="manipulating-data.html#manipulating-data-s7">Updating objects saved or loaded in the current session</a></dt><dt>6.5. <a href="manipulating-data.html#manipulating-data-s8">Updating objects saved or loaded in a previous session</a></dt><dt>6.6. <a href="manipulating-data.html#manipulating-data-s9">Deleting persistent objects</a></dt><dt>6.7. <a href="manipulating-data.html#manipulating-data-s10">Graphs of objects</a></dt><dd><dl><dt>6.7.1. <a href="manipulating-data.html#manipulating-data-s11a">Lifecycle objects</a></dt><dt>6.7.2. <a href="manipulating-data.html#manipulating-data-s11b">Persistence by Reachability</a></dt></dl></dd><dt>6.8. <a href="manipulating-data.html#manipulating-data-s12">Flushing</a></dt><dt>6.9. <a href="manipulating-data.html#manipulating-data-s13">Ending a Session</a></dt><dd><dl><dt>6.9.1. <a href="manipulating-data.html#manipulating-data-s13-1">Flushing the session</a></dt><dt>6.9.2. <a href="manipulating-data.html#manipulating-data-s13-2">Committing the transaction</a></dt><dt>6.9.3. <a href="manipulating-data.html#manipulating-data-s13-3">Closing the session</a></dt><dt>6.9.4. <a href="manipulating-data.html#manipulating-data-s13-4">Exception handling</a></dt></dl></dd><dt>6.10. <a href="manipulating-data.html#manipulating-data-s14">Interceptors</a></dt></dl></dd><dt>7. <a href="query-language.html">Hibernate Query Language</a></dt><dd><dl><dt>7.1. <a href="query-language.html#query-language-s1">Case Sensitivity</a></dt><dt>7.2. <a href="query-language.html#query-language-s2">The from clause</a></dt><dt>7.3. <a href="query-language.html#query-language-s3">Associations and joins</a></dt><dt>7.4. <a href="query-language.html#query-language-s4">The select clause</a></dt><dt>7.5. <a href="query-language.html#query-language-s4a">Aggregate functions</a></dt><dt>7.6. <a href="query-language.html#query-language-s4b">polymorphism</a></dt><dt>7.7. <a href="query-language.html#query-language-s5">The where clause</a></dt><dt>7.8. <a href="query-language.html#query-language-s6">Expressions</a></dt><dt>7.9. <a href="query-language.html#query-language-s7">The order by clause</a></dt><dt>7.10. <a href="query-language.html#query-language-s8">The group by clause</a></dt><dt>7.11. <a href="query-language.html#query-language-s9">Subqueries</a></dt></dl></dd><dt>8. <a href="transactions.html">Transactions And Concurrency</a></dt><dd><dl><dt>8.1. <a href="transactions.html#transactions-s1">Configurations, Sessions and Factories</a></dt><dt>8.2. <a href="transactions.html#transactions-s2">Threads and connections</a></dt><dt>8.3. <a href="transactions.html#transactions-s3">Optimistic Locking / Versioning</a></dt><dd><dl><dt>8.3.1. <a href="transactions.html#transactions-s3-1">Long session with automatic versioning</a></dt><dt>8.3.2. <a href="transactions.html#transactions-s3-2">Many sessions with automatic versioning</a></dt><dt>8.3.3. <a href="transactions.html#transactions-s3-3">Application version checking</a></dt></dl></dd><dt>8.4. <a href="transactions.html#transactions-s4">Session disconnection</a></dt><dt>8.5. <a href="transactions.html#transactions-s5">Pessimistic Locking</a></dt></dl></dd><dt>9. <a href="examples.html">Examples</a></dt><dd><dl><dt>9.1. <a href="examples.html#examples-s0">Employer/Employee</a></dt><dt>9.2. <a href="examples.html#examples-s1">Author/Work</a></dt><dt>9.3. <a href="examples.html#examples-s2">Customer/Order/Product</a></dt></dl></dd><dt>10. <a href="best-practices.html">Best Practices</a></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="architecture.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Architecture</td></tr></table></div></body></html> \ No newline at end of file Index: query-language.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/html/query-language.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** query-language.html 23 Feb 2003 13:45:25 -0000 1.3 --- query-language.html 2 Mar 2003 13:59:02 -0000 1.4 *************** *** 8,41 **** <tt class="literal">net.sf.hibernate.eg.FOO</tt> is not <tt class="literal">net.sf.hibernate.eg.Foo</tt> and ! <tt class="literal">foo.Bar</tt> is not ! <tt class="literal">foo.BAR</tt>. </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s2"></a>7.2. The from clause</h2></div></div><div></div></div><p> The simplest possible Hibernate query is of the form: ! </p><pre class="programlisting">from cat in class eg.Cat</pre><p> which simply returns all instances of the class <tt class="literal">eg.Cat</tt>. The query assigns the alias <tt class="literal">cat</tt> to <tt class="literal">Cat</tt> ! instances, so we could use that alias later in the query. ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s3"></a>7.3. The select clause</h2></div></div><div></div></div><p> ! A multipart <tt class="literal">from</tt> clause is possible. The <tt class="literal">select</tt> ! clause picks which classes to return in the result set. Consider: ! </p><pre class="programlisting">select mate from cat in class eg.Cat, mate in class eg.Cat ! where mate = cat.mate</pre><p> The query will select <tt class="literal">mate</tt>s of other <tt class="literal">Cat</tt>s. Actually, you may express this query more compactly as: ! </p><pre class="programlisting">select cat.mate from cat in class eg.Cat</pre><p>You may even select collection elements:</p><pre class="programlisting">select cat.kittens.elements from cat in class eg.Cat</pre><p> ! Queries may return properties any value type including properties of component type: ! </p><pre class="programlisting">select cat.name from cat in class eg.DomesticCat ! where cat.name like 'fri%'</pre><p> ! You may select multiple objects (Hibernate will return them in an array of type ! <tt class="literal">Object[]</tt>) ! </p><pre class="programlisting">select mother, offspr ! from mother in class eg.DomesticCat, offspr in class eg.Cat ! where offspr in mother.kittens.elements </pre><p> ! Queryies may even return aggregate functions of properties. Collections may also appear ! inside aggregate functions in the <tt class="literal">select</tt> clause. </p><pre class="programlisting">select avg(cat.weight), sum(cat.weight), max(cat.weight), count(cat) ! from cat in class eg.Cat ! select cat, count(cat.kittens.elements) from cat in class eg.Cat group by cat</pre><p> The supported aggregate functions are </p><div class="itemizedlist"><ul type="disc" compact><li><p> --- 8,86 ---- <tt class="literal">net.sf.hibernate.eg.FOO</tt> is not <tt class="literal">net.sf.hibernate.eg.Foo</tt> and ! <tt class="literal">foo.barSet</tt> is not ! <tt class="literal">foo.BARSET</tt>. </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s2"></a>7.2. The from clause</h2></div></div><div></div></div><p> The simplest possible Hibernate query is of the form: ! </p><pre class="programlisting">from eg.Cat as cat</pre><p> which simply returns all instances of the class <tt class="literal">eg.Cat</tt>. The query assigns the alias <tt class="literal">cat</tt> to <tt class="literal">Cat</tt> ! instances, so we could use that alias later in the query. The <tt class="literal">as</tt> ! keyword is optional; we could also write: ! </p><pre class="programlisting">from eg.Cat cat</pre><p> ! Multiple classes may appear, resulting in a cartesian product or "cross" join. ! </p><pre class="programlisting">from Formula as form, Parameter as param</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s3"></a>7.3. Associations and joins</h2></div></div><div></div></div><p> ! We may also define aliases to associated entities using a <tt class="literal">join</tt>. ! </p><pre class="programlisting">from eg.Cat as cat ! inner join cat.mate as mate ! left outer join cat.kittens as kitten ! ! from eg.Cat as cat left join cat.mate.kittens as kittens ! ! from Formula form full join form.parameter param</pre><p> ! The supported join types are borrowed from ANSI SQL ! </p><div class="itemizedlist"><ul type="disc" compact><li><p> ! <tt class="literal">inner join</tt> ! </p></li><li><p> ! <tt class="literal">left outer join</tt> ! </p></li><li><p> ! <tt class="literal">right outer join</tt> (not recommended) ! </p></li><li><p> ! <tt class="literal">full join</tt> (not usually useful) ! </p></li></ul></div><p> ! The <tt class="literal">inner join</tt>, <tt class="literal">left outer join</tt> and ! <tt class="literal">right outer join</tt> constructs may be abbreviated. ! </p><pre class="programlisting">from eg.Cat as cat ! join cat.mate as mate ! left join cat.kittens as kitten</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s4"></a>7.4. The select clause</h2></div></div><div></div></div><p> ! The <tt class="literal">select</tt> clause picks which objects and properties to return in ! the query result set. Consider: ! </p><pre class="programlisting">select mate ! from eg.Cat cat ! inner join cat.mate cat</pre><p> The query will select <tt class="literal">mate</tt>s of other <tt class="literal">Cat</tt>s. Actually, you may express this query more compactly as: ! </p><pre class="programlisting">select cat.mate from eg.Cat cat</pre><p> ! You may even select collection elements, using the special <tt class="literal">elements</tt> ! function. The following query returns all kittens of any cat. ! </p><pre class="programlisting">select elements(cat.kittens) from eg.Cat cat</pre><p> ! Queries may return properties of any value type including properties of component type: ! </p><pre class="programlisting">select cat.name from eg.DomesticCat cat ! where cat.name like 'fri%' ! ! select cust.name.firstName from Customer as cust</pre><p> ! Queries may return multiple objects and/or properties as an array of type ! <tt class="literal">Object[]</tt> ! </p><pre class="programlisting">select cat, offspr, mate.name ! from eg.DomesticCat as mother ! inner join mother.mate as mate ! left outer join mother.kittens as offspr</pre><p> ! or as an actual typesafe Java object ! </p><pre class="programlisting">select new Family(cat, mate, offspr) ! from eg.DomesticCat as mother ! join mother.mate as mate ! left join mother.kittens as offspr</pre><p> ! assuming that the class <tt class="literal">Family</tt> has an appropriate constructor. ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s4a"></a>7.5. Aggregate functions</h2></div></div><div></div></div><p> ! Queryies may even return aggregate functions of properties. </p><pre class="programlisting">select avg(cat.weight), sum(cat.weight), max(cat.weight), count(cat) ! from eg.Cat cat></programlisting> ! <para> ! Collections may also appear inside aggregate functions in the <literal>select</literal> ! clause. ! </para> ! ! <programlisting><![CDATA[select cat, count( elements(cat.kittens) ) ! from eg.Cat cat group by cat</pre><p> The supported aggregate functions are </p><div class="itemizedlist"><ul type="disc" compact><li><p> *************** *** 48,79 **** The <tt class="literal">distinct</tt> and <tt class="literal">all</tt> keywords may be used and have the same semantics as in SQL. ! </p><pre class="programlisting">select distinct cat.name from cat in class eg.Cat</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s3b"></a>7.4. polymorphism</h2></div></div><div></div></div><p> A query like: ! </p><pre class="programlisting">from cat in class eg.Cat</pre><p> returns instances not only of <tt class="literal">Cat</tt>, but also of subclasses like ! <tt class="literal">DomesticCat</tt>. Hibernate queries may name <span class="emphasis"><em>any</em></span> ! Java class or interface in the <tt class="literal">from</tt> clause. The query will ! return instances of all persistent classes that extend that class or implement ! the interface. The following query would return all persistent objects: ! </p><pre class="programlisting">from o in class java.lang.Object</pre><p> The interface <tt class="literal">Named</tt> might be implemented by various persistent classes: ! </p><pre class="programlisting">from n in class eg.Named, m in class eg.Named where n.name = m.name</pre><p> Note that these last two queries will require more than one SQL <tt class="literal">SELECT</tt>. This means that the <tt class="literal">order by</tt> clause does not correctly order the whole result set. (It also means you can't call these queries using <tt class="literal">Query.scroll()</tt>.) ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s4"></a>7.5. from collections</h2></div></div><div></div></div><p> ! You can select entities (but not values) from a collection ! </p><pre class="programlisting">select kitten from ! cat in class eg.Cat, ! kitten in cat.kittens.elements</pre><p> ! The <tt class="literal">elements</tt> construct is like a special property referring to the ! element set of the collection. ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s5"></a>7.6. The where clause</h2></div></div><div></div></div><p> ! The <tt class="literal">where</tt> clause allows you to narrow the list ! of instances returned. ! </p><pre class="programlisting">from cat in class eg.Cat where cat.name='Fritz'</pre><p> returns instances of <tt class="literal">Cat</tt> named 'Fritz'. ! </p><pre class="programlisting">select foo from foo in class eg.Foo, bar in class eg.Bar where foo.startDate = bar.date</pre><p> will return all instances of <tt class="literal">Foo</tt> for which --- 93,118 ---- The <tt class="literal">distinct</tt> and <tt class="literal">all</tt> keywords may be used and have the same semantics as in SQL. ! </p><pre class="programlisting">select distinct cat.name from eg.Cat cat ! ! select count(distinct cat.name), count(cat) from eg.Cat cat</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s4b"></a>7.6. polymorphism</h2></div></div><div></div></div><p> A query like: ! </p><pre class="programlisting">from eg.Cat as cat</pre><p> returns instances not only of <tt class="literal">Cat</tt>, but also of subclasses like ! <tt class="literal">DomesticCat</tt>. Hibernate queries may name <span class="emphasis"><em>any</em></span> Java ! class or interface in the <tt class="literal">from</tt> clause. The query will return instances ! of all persistent classes that extend that class or implement the interface. The following ! query would return all persistent objects: ! </p><pre class="programlisting">from java.lang.Object o</pre><p> The interface <tt class="literal">Named</tt> might be implemented by various persistent classes: ! </p><pre class="programlisting">from eg.Named n, eg.Named m where n.name = m.name</pre><p> Note that these last two queries will require more than one SQL <tt class="literal">SELECT</tt>. This means that the <tt class="literal">order by</tt> clause does not correctly order the whole result set. (It also means you can't call these queries using <tt class="literal">Query.scroll()</tt>.) ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s5"></a>7.7. The where clause</h2></div></div><div></div></div><p> ! The <tt class="literal">where</tt> clause allows you to narrow the list of instances returned. ! </p><pre class="programlisting">from eg.Cat as cat where cat.name='Fritz'</pre><p> returns instances of <tt class="literal">Cat</tt> named 'Fritz'. ! </p><pre class="programlisting">select foo from eg.Foo foo, eg.Bar bar where foo.startDate = bar.date</pre><p> will return all instances of <tt class="literal">Foo</tt> for which *************** *** 83,90 **** <tt class="literal">Foo</tt>. Compound path expressions make the <tt class="literal">where</tt> clause extremely powerful. Consider: ! </p><pre class="programlisting">from cat in class eg.Cat where cat.mate.name is not null</pre><p> ! This query translates to an SQL query with a table join. If you were to write something like ! </p><pre class="programlisting">from foo in class eg.Foo where foo.bar.baz.customer.address.city is not null</pre><p> you would end up with a query that would require four table joins in SQL. --- 122,129 ---- <tt class="literal">Foo</tt>. Compound path expressions make the <tt class="literal">where</tt> clause extremely powerful. Consider: ! </p><pre class="programlisting">from eg.Cat cat where cat.mate.name is not null</pre><p> ! This query translates to an SQL query with a table (inner) join. If you were to write something like ! </p><pre class="programlisting">from eg.Foo foo where foo.bar.baz.customer.address.city is not null</pre><p> you would end up with a query that would require four table joins in SQL. *************** *** 92,104 **** The <tt class="literal">=</tt> operator may be used to compare not only properties, but also instances: ! </p><pre class="programlisting">from cat in class eg.Cat, rival in class eg.Cat where cat.mate = rival.mate ! select cat, mate from cat in class eg.Cat, mate in class eg.Cat where cat.mate = mate</pre><p> The special property (lowercase) <tt class="literal">id</tt> may be used to reference the unique identifier of an object. (You may also use its property name.) ! </p><pre class="programlisting">from cat in class eg.Cat where cat.id = 123 ! from cat in class eg.Cat where cat.mate.id = 69</pre><p> The second query is efficient. No table join is required! </p><p> --- 131,143 ---- The <tt class="literal">=</tt> operator may be used to compare not only properties, but also instances: ! </p><pre class="programlisting">from eg.Cat cat, eg.Cat rival where cat.mate = rival.mate ! select cat, mate from eg.Cat cat, eg.Cat mate where cat.mate = mate</pre><p> The special property (lowercase) <tt class="literal">id</tt> may be used to reference the unique identifier of an object. (You may also use its property name.) ! </p><pre class="programlisting">from eg.Cat as cat where cat.id = 123 ! from eg.Cat as cat where cat.mate.id = 69</pre><p> The second query is efficient. No table join is required! </p><p> *************** *** 106,113 **** has a composite identifier consisting of <tt class="literal">country</tt> and <tt class="literal">medicareNumber</tt>. ! </p><pre class="programlisting">from person in class bank.Person where person.id.country = 'AU' and person.id.medicareNumber = 123456 ! from account in class bank.Account where account.owner.id.country = 'AU' and account.owner.id.medicareNumber = 123456</pre><p> Once again, the second query requires no table join. --- 145,152 ---- has a composite identifier consisting of <tt class="literal">country</tt> and <tt class="literal">medicareNumber</tt>. ! </p><pre class="programlisting">from bank.Person person where person.id.country = 'AU' and person.id.medicareNumber = 123456 ! from bank.Account account where account.owner.id.country = 'AU' and account.owner.id.medicareNumber = 123456</pre><p> Once again, the second query requires no table join. *************** *** 116,120 **** of an instance in the case of polymorphic persistence. A Java class name embedded in the where clause will be translated to its discriminator value. ! </p><pre class="programlisting">from cat in class eg.Cat where cat.class = eg.DomesticCat</pre><p> You may also specify properties of components (and of components of components). Never try to use a path-expression that ends in a property of component type --- 155,159 ---- of an instance in the case of polymorphic persistence. A Java class name embedded in the where clause will be translated to its discriminator value. ! </p><pre class="programlisting">from eg.Cat cat where cat.class = eg.DomesticCat</pre><p> You may also specify properties of components (and of components of components). Never try to use a path-expression that ends in a property of component type *************** *** 122,126 **** is an entity with a component <tt class="literal">address</tt> </p><pre class="programlisting">store.owner.address.city //okay ! store.owner.address //error!</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s6"></a>7.7. Expressions</h2></div></div><div></div></div><p> Expressions allowed in the <tt class="literal">where</tt> clause include most of the kind of things you could write in SQL: --- 161,165 ---- is an entity with a component <tt class="literal">address</tt> </p><pre class="programlisting">store.owner.address.city //okay ! store.owner.address //error!</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s6"></a>7.8. Expressions</h2></div></div><div></div></div><p> Expressions allowed in the <tt class="literal">where</tt> clause include most of the kind of things you could write in SQL: *************** *** 152,188 **** </p></li></ul></div><p> <tt class="literal">in</tt> and <tt class="literal">between</tt> may be used as follows: ! </p><pre class="programlisting">from cat in class eg.DomesticCat where cat.name between 'A' and 'B' ! from cat in class eg.DomesticCat where cat.name in ( 'Foo', 'Bar', Baz" )</pre><p> and the negated forms may be written ! </p><pre class="programlisting">from cat in class eg.DomesticCat where cat.name not between 'A' and 'B' ! from cat in class eg.DomesticCat where cat.name not in ( 'Foo', 'Bar', Baz" )</pre><p> Likewise, <tt class="literal">is null</tt> and <tt class="literal">is not null</tt> may be used to test for null values. </p><p> ! You may test the size of a collection with the special property <tt class="literal">size</tt> ! </p><pre class="programlisting">from cat in class eg.Cat where cat.kittens.size > 0</pre><p> For indexed collections, you may refer to the minimum and maximum indices using <tt class="literal">minIndex</tt> and <tt class="literal">maxIndex</tt>. Similarly, you may refer to the minimum and maximum elements of a collection of basic type using <tt class="literal">minElement</tt> and <tt class="literal">maxElement</tt>. ! </p><pre class="programlisting">from cal in class Calendar where cal.holidays.maxElement > current date</pre><p> ! The SQL functions <tt class="literal">any, some, all, exists, in</tt> are supported when passed one of ! two special properties of a collection. The special properties are <tt class="literal">elements</tt> and ! <tt class="literal">indices</tt>. Respectively they represent the element set and the index set of the ! collection. ! </p><pre class="programlisting">select mother from mother in class eg.Cat, kit in class eg.Cat ! where kit in foo.kittens.elements ! select p from list in class eg.NameList, p in class eg.Person ! where p.name = some list.names.elements ! from cat in class eg.Cat where exists cat.kittens.elements ! from p in class eg.Player where 3 > all p.scores.elements ! from show in class eg.Show ! where 'fizard' in show.acts.indices</pre><p> Note that these constructs - <tt class="literal">size</tt>, <tt class="literal">elements</tt>, <tt class="literal">indices</tt>, <tt class="literal">minIndex</tt>, <tt class="literal">maxIndex</tt>, --- 191,232 ---- </p></li></ul></div><p> <tt class="literal">in</tt> and <tt class="literal">between</tt> may be used as follows: ! </p><pre class="programlisting">from eg.DomesticCat cat where cat.name between 'A' and 'B' ! from eg.DomesticCat cat where cat.name in ( 'Foo', 'Bar', Baz" )</pre><p> and the negated forms may be written ! </p><pre class="programlisting">from eg.DomesticCat cat where cat.name not between 'A' and 'B' ! from eg.DomesticCat cat where cat.name not in ( 'Foo', 'Bar', Baz" )</pre><p> Likewise, <tt class="literal">is null</tt> and <tt class="literal">is not null</tt> may be used to test for null values. </p><p> ! You may test the size of a collection with the special property <tt class="literal">size</tt>, or ! the special <tt class="literal">size()</tt> function. ! </p><pre class="programlisting">from eg.Cat cat where cat.kittens.size > 0 ! ! from eg.Cat cat where size(cat.kittens) > 0</pre><p> For indexed collections, you may refer to the minimum and maximum indices using <tt class="literal">minIndex</tt> and <tt class="literal">maxIndex</tt>. Similarly, you may refer to the minimum and maximum elements of a collection of basic type using <tt class="literal">minElement</tt> and <tt class="literal">maxElement</tt>. ! </p><pre class="programlisting">from Calendar cal where cal.holidays.maxElement > current date</pre><p> ! There are also functional forms (which, unlike the constructs above, are not case sensitive): ! </p><pre class="programlisting">from Order order where maxindex(order.items) > 100 ! from Order order where minelement(order.items) > 10000</pre><p> ! The SQL functions <tt class="literal">any, some, all, exists, in</tt> are supported when passed the element ! or index set of a collection (<tt class="literal">elements</tt> and <tt class="literal">indices</tt> functions) ! or the result of a subquery (see below). ! </p><pre class="programlisting">select mother from eg.Cat as mother, eg.Cat as kit ! where kit in elements(foo.kittens) ! select p from eg.NameList list, eg.Person p ! where p.name = some elements(list.names) ! from eg.Cat cat where exists elements(cat.kittens) ! from eg.Player p where 3 > all elements(p.scores) ! ! from eg.Show show where 'fizard' in indices(show.acts)</pre><p> Note that these constructs - <tt class="literal">size</tt>, <tt class="literal">elements</tt>, <tt class="literal">indices</tt>, <tt class="literal">minIndex</tt>, <tt class="literal">maxIndex</tt>, *************** *** 192,226 **** in a <tt class="literal">where</tt> clause: only for databases with subselects </p></li><li><p> - in a <tt class="literal">from</tt> clause: only <tt class="literal">elements</tt> makes sense ... and - only for a collection of entities - </p></li><li><p> in a <tt class="literal">select</tt> clause: only <tt class="literal">elements</tt> and <tt class="literal">indices</tt> make sense </p></li></ul></div><p> Elements of indexed collections (arrays, lists, maps) may be referred to by index (in a where clause only) ! </p><pre class="programlisting">from order in class Order where order.items[0].id = 1234 ! select person from person in class Person, calendar in class Calendar where calendar.holidays['national day'] = person.birthDay and person.nationality.calendar = calendar ! select item from item in class Item, order in class Order where order.items[ order.deliveredItemIndices[0] ] = item and order.id = 11 ! select item from item in class Item, order in class Order ! where order.items[order.items.maxIndex] = item and order.id = 11</pre><p> The expression inside <tt class="literal">[]</tt> may even be an arithmetic expression. ! </p><p> Scalar SQL functions supported by the underlying database may be used ! </p><pre class="programlisting">from cat in class eg.DomesticCat where upper(cat.name) like 'FRI%'</pre><p> If you are not yet convinced by all this, think how much longer and less readable the following query would be in SQL: </p><pre class="programlisting">select cust ! from prod in class Product, ! store in class Store, ! cust in store.customers where prod.name = 'widget' and store.location.name in ( 'Melbourne', 'Sydney' ) ! and prod = all cust.currentOrder.lineItems.elements</pre><p> <span class="emphasis"><em>Hint:</em></span> something like </p><pre class="programlisting">SELECT cust.name, cust.address, cust.phone, cust.id, cust.current_order --- 236,268 ---- in a <tt class="literal">where</tt> clause: only for databases with subselects </p></li><li><p> in a <tt class="literal">select</tt> clause: only <tt class="literal">elements</tt> and <tt class="literal">indices</tt> make sense </p></li></ul></div><p> Elements of indexed collections (arrays, lists, maps) may be referred to by index (in a where clause only) ! </p><pre class="programlisting">from Order order where order.items[0].id = 1234 ! select person from Person person, Calendar calendar where calendar.holidays['national day'] = person.birthDay and person.nationality.calendar = calendar ! select item from Item item, Order order where order.items[ order.deliveredItemIndices[0] ] = item and order.id = 11 ! select item from Item item, Order order ! where order.items[ maxindex(order.items) ] = item and order.id = 11</pre><p> The expression inside <tt class="literal">[]</tt> may even be an arithmetic expression. ! </p><pre class="programlisting">select item from Item item, Order order ! where order.items[ size(order.items) - 1 ] = item</pre><p> Scalar SQL functions supported by the underlying database may be used ! </p><pre class="programlisting">from eg.DomesticCat cat where upper(cat.name) like 'FRI%'</pre><p> If you are not yet convinced by all this, think how much longer and less readable the following query would be in SQL: </p><pre class="programlisting">select cust ! from Product prod, ! Store store ! inner join store.customers cust where prod.name = 'widget' and store.location.name in ( 'Melbourne', 'Sydney' ) ! and prod = all elements(cust.currentOrder.lineItems)</pre><p> <span class="emphasis"><em>Hint:</em></span> something like </p><pre class="programlisting">SELECT cust.name, cust.address, cust.phone, cust.id, cust.current_order *************** *** 240,266 **** WHERE item.order_id = o.id AND cust.current_order = o.id ! )</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s7"></a>7.8. The order by clause</h2></div></div><div></div></div><p> The list returned by a query may be ordered by any property of a returned class or components: ! </p><pre class="programlisting">from cat in class eg.DomesticCat order by cat.name asc, cat.weight desc, cat.birthdate</pre><p> The optional <tt class="literal">asc</tt> or <tt class="literal">desc</tt> indicate ascending or descending order respectively. ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s8"></a>7.9. The group by clause</h2></div></div><div></div></div><p> A query that returns aggregate values may be grouped by any property of a returned class or components: ! </p><pre class="programlisting">select cat.color, sum(cat.weight), count(cat) from cat in class eg.Cat group by cat.color ! select foo.id, avg(foo.names.elements), max(foo.names.indices) from foo in class eg.Foo group by foo.id</pre><p>Note: You may use the <tt class="literal">elements</tt> and <tt class="literal">indices</tt> constructs ! inside a select clause, even on databases with no subselects.</p><p>A <tt class="literal">having</tt> clause is also allowed.</p><pre class="programlisting">select cat.color, sum(cat.weight), count(cat) from foo in class eg.Foo ! group by cat.color having cat.color in (eg.Color.TABBY, eg.Color.BLACK)</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s9"></a>7.10. Subqueries</h2></div></div><div></div></div><p> For databases that support subselects, Hibernate supports subqueries within queries. A subquery must ! be surrounded by parentheses (often by an SQL aggregate function call). eg. ! </p><pre class="programlisting">from cat in class eg.Cat where cat.weight > ! ( select avg(cat.weight) from cat in class eg.DomesticCat ) ! from cat in class eg.DomesticCat where cat.name = ! some( select list.name from list in class eg.NameList ) ! from cat in class eg.Cat where not exists ! ( from mate in class eg.Cat where mate.mate = cat )</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="manipulating-data.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="transactions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 6. Manipulating Persistent Data </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 8. Transactions And Concurrency</td></tr></table></div></body></html> \ No newline at end of file --- 282,309 ---- WHERE item.order_id = o.id AND cust.current_order = o.id ! )</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s7"></a>7.9. The order by clause</h2></div></div><div></div></div><p> The list returned by a query may be ordered by any property of a returned class or components: ! </p><pre class="programlisting">from eg.DomesticCat cat order by cat.name asc, cat.weight desc, cat.birthdate</pre><p> The optional <tt class="literal">asc</tt> or <tt class="literal">desc</tt> indicate ascending or descending order respectively. ! </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s8"></a>7.10. The group by clause</h2></div></div><div></div></div><p> A query that returns aggregate values may be grouped by any property of a returned class or components: ! </p><pre class="programlisting">select cat.color, sum(cat.weight), count(cat) from eg.Cat cat group by cat.color ! select foo.id, avg( elements(foo.names) ), max( indices(foo.names) ) from eg.Foo foo group by foo.id</pre><p>Note: You may use the <tt class="literal">elements</tt> and <tt class="literal">indices</tt> constructs ! inside a select clause, even on databases with no subselects.</p><p>A <tt class="literal">having</tt> clause is also allowed.</p><pre class="programlisting">select cat.color, sum(cat.weight), count(cat) from eg.Cat cat ! group by cat.color having cat.color in (eg.Color.TABBY, eg.Color.BLACK)</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="query-language-s9"></a>7.11. Subqueries</h2></div></div><div></div></div><p> For databases that support subselects, Hibernate supports subqueries within queries. A subquery must ! be surrounded by parentheses (often by an SQL aggregate function call). Even /correlated/ subqueries ! (subqueries that refer to an alias in the outer query) are allowed. ! </p><pre class="programlisting">from eg.Cat fatcat where fatcat.weight > ! ( select avg(cat.weight) from eg.DomesticCat cat ) ! from eg.DomesticCat cat where cat.name = ! some( select list.name from eg.NameList list ) ! from eg.Cat cat where not exists ! ( from eg.Cat mate where mate.mate = cat )</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="manipulating-data.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="transactions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top... [truncated message content] |