From: <one...@us...> - 2002-11-24 10:55:29
|
Update of /cvsroot/hibernate/Hibernate/doc/reference/html In directory sc8-pr-cvs1:/tmp/cvs-serv19596/doc/reference/html Modified Files: manipulating-data.html query-language.html Log Message: documented fact that find() may now fetch scalar values Index: manipulating-data.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html/manipulating-data.html,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** manipulating-data.html 21 Nov 2002 09:03:22 -0000 1.23 --- manipulating-data.html 24 Nov 2002 10:55:26 -0000 1.24 *************** *** 140,149 **** .... }</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" + --- 140,146 ---- .... }</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" + *************** *** 157,161 **** ..... }</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 --- 154,161 ---- ..... }</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 *************** *** 232,238 **** </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 --- 232,236 ---- </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 Index: query-language.html =================================================================== RCS file: /cvsroot/hibernate/Hibernate/doc/reference/html/query-language.html,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** query-language.html 19 Nov 2002 15:35:35 -0000 1.21 --- query-language.html 24 Nov 2002 10:55:26 -0000 1.22 *************** *** 22,26 **** 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> --- 22,26 ---- 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> *************** *** 30,36 **** 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 --- 30,35 ---- 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 |