From: <one...@us...> - 2002-11-24 10:55:29
|
Update of /cvsroot/hibernate/Hibernate/doc/reference/html_single In directory sc8-pr-cvs1:/tmp/cvs-serv19596/doc/reference/html_single Modified Files: index.html Log Message: documented fact that find() may now fetch scalar values Index: index.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html_single/index.html,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** index.html 21 Nov 2002 09:03:27 -0000 1.82 --- index.html 24 Nov 2002 10:55:26 -0000 1.83 *************** *** 2111,2120 **** .... }</pre><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="manipulating-data-s4"></a>6.3.1. Scalar queries</h3></div></div><p> ! Queries called using <tt>iterate()</tt> may specify a property of a class ! in the <tt>select</tt> clause. They may even call SQL aggregate functions. ! Properties or aggregates are considered "scalar" results. ! </p><p> ! In the current version, <tt>Session.find()</tt> may not be used to return ! scalar results (it <span class="emphasis"><em>always</em></span> returns entities). </p><pre class="programlisting">Iterator results = sess.iterate( "select cat.color, min(cat.birthdate), count(cat) from cat in class eg.Cat" + --- 2111,2117 ---- .... }</pre><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="manipulating-data-s4"></a>6.3.1. Scalar queries</h3></div></div><p> ! Queries may specify a property of a class in the <tt>select</tt> clause. ! They may even call SQL aggregate functions. Properties or aggregates are considered ! "scalar" results. </p><pre class="programlisting">Iterator results = sess.iterate( "select cat.color, min(cat.birthdate), count(cat) from cat in class eg.Cat" + *************** *** 2128,2132 **** ..... }</pre><pre class="programlisting">Iterator iter = sess.iterate( ! "select cat.type, cat.birthdate, cat.name from cat in class eg.DomesticCat");</pre></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="manipulating-data-s5"></a>6.3.2. The Query interface</h3></div></div><p> If you need to specify bounds upon your result set (the maximum number of rows you want to retrieve and / or the first row you want to retrieve) you should --- 2125,2132 ---- ..... }</pre><pre class="programlisting">Iterator iter = sess.iterate( ! "select cat.type, cat.birthdate, cat.name from cat in class eg.DomesticCat" ! );</pre><pre class="programlisting">List list = sess.find( ! "select cat, cat.mate.name from cat in class eg.DomesticCat" ! );</pre></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="manipulating-data-s5"></a>6.3.2. The Query interface</h3></div></div><p> If you need to specify bounds upon your result set (the maximum number of rows you want to retrieve and / or the first row you want to retrieve) you should *************** *** 2203,2209 **** </p><pre class="programlisting">Collection blackKittenMates = session.filter( pk.getKittens(), "select this.mate where this.color = eg.Color.BLACK" ! )</pre><p> ! However, filters are <tt>find()</tt>-style queries; you can't select scalar values. ! </p></div></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="manipulating-data-s7"></a>6.4. Updating objects saved or loaded in the current session</h2></div></div><p> <span class="emphasis"><em>Persistent instances</em></span> (ie. objects loaded, saved, created or queried by the <tt>Session</tt>) may be manipulated by the application --- 2203,2207 ---- </p><pre class="programlisting">Collection blackKittenMates = session.filter( pk.getKittens(), "select this.mate where this.color = eg.Color.BLACK" ! )</pre></div></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="manipulating-data-s7"></a>6.4. Updating objects saved or loaded in the current session</h2></div></div><p> <span class="emphasis"><em>Persistent instances</em></span> (ie. objects loaded, saved, created or queried by the <tt>Session</tt>) may be manipulated by the application *************** *** 2569,2573 **** 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> ! For <tt>iterate()</tt> queries you may select any property (not just associations). </p><pre class="programlisting">select cat.name from cat in class eg.DomesticCat where cat.name like 'fri%'</pre><p> --- 2567,2571 ---- 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> ! You may select any property (not just associations): </p><pre class="programlisting">select cat.name from cat in class eg.DomesticCat where cat.name like 'fri%'</pre><p> *************** *** 2577,2583 **** from mother in class eg.DomesticCat, offspr in class eg.Cat where offspr in mother.kittens.elements </pre><p> ! Queries called called using <tt>iterate()</tt> may return properties of value type ! and may even return aggregate functions of these properties. Collections may also appear inside ! aggregate functions in the <tt>select</tt> clause. </p><pre class="programlisting">select cat.name, cat.mate.name from cat in class eg.Cat --- 2575,2580 ---- from mother in class eg.DomesticCat, offspr in class eg.Cat where offspr in mother.kittens.elements </pre><p> ! Queries may return properties of value type and may even return aggregate functions of these properties. ! Collections may also appear inside aggregate functions in the <tt>select</tt> clause. </p><pre class="programlisting">select cat.name, cat.mate.name from cat in class eg.Cat |