[jboss-cvs] JBossAS SVN: r103235 - in projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US: extras and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 30 02:57:21 EDT 2010


Author: laubai
Date: 2010-03-30 02:57:20 -0400 (Tue, 30 Mar 2010)
New Revision: 103235

Modified:
   projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Batch_processing.xml
   projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/EJBQL_The_Object_Query_Language.xml
   projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Native_query.xml
   projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-1.java
   projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-2.java
Log:
JBPAPP-1723 Numerous corrections, including to code examples.

Modified: projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Batch_processing.xml
===================================================================
--- projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Batch_processing.xml	2010-03-30 06:56:15 UTC (rev 103234)
+++ projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Batch_processing.xml	2010-03-30 06:57:20 UTC (rev 103235)
@@ -47,7 +47,7 @@
 		
 		<programlisting language="Java"><xi:include href="extras/Code_Example_35.java" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include></programlisting>
 		<para>
-			The <literal>int</literal> value returned by the <literal>Query.executeUpdate()</literal> method indicate the number of entities effected by the operation. This may or may not correlate with the number of rows effected in the database. An EJB-QL bulk operation might result in multiple actual SQL statements being executed, for joined-subclass, for example. The returned number indicates the number of actual entities affected by the statement. Going back to the example of joined-subclass, a delete against one of the subclasses may actually result in deletes against not just the table to which that subclass is mapped, but also the "root" table and potentially joined-subclass tables further down the inheritance hierarchy.
+			The <literal>int</literal> value returned by the <literal>Query.executeUpdate()</literal> method indicate the number of entities affected by the operation. This may or may not correlate with the number of rows affected in the database. An EJB-QL bulk operation might result in multiple actual SQL statements being executed, for joined-subclass, for example. The returned number indicates the number of actual entities affected by the statement. Going back to the example of joined-subclass, a delete against one of the subclasses may actually result in deletes against not just the table to which that subclass is mapped, but also the "root" table and potentially joined-subclass tables further down the inheritance hierarchy.
 		</para>
 	</section>
 

Modified: projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/EJBQL_The_Object_Query_Language.xml
===================================================================
--- projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/EJBQL_The_Object_Query_Language.xml	2010-03-30 06:56:15 UTC (rev 103234)
+++ projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/EJBQL_The_Object_Query_Language.xml	2010-03-30 06:57:20 UTC (rev 103235)
@@ -5,7 +5,7 @@
 <chapter id="chap-Hibernate_EntityManager_User_Guide-EJB_QL_The_Object_Query_Language">
 	<title>EJB-QL: The Object Query Language</title>
 	<para>
-		EJB3-QL has been heavily inspired by HQL, the native Hibernate Query Language. Both are therefore very close to SQL, but portable and independent of the database schema. People familiar with HQL shouldn't have any problem using EJB-QL. Actually, you use the same query API for EJB-QL and HQL queries. Portable EJB3 applications however should stick to EJB-QL or similar vendor extensions are needed.
+		EJB3-QL has been heavily inspired by HQL, the native Hibernate Query Language. Both are therefore very close to SQL, but portable and independent of the database schema. People familiar with HQL shouldn't have any problem using EJB-QL. Actually, you use the same query API for EJB-QL and HQL queries. To remain portable, applications should stick to EJB-QL without vendor-specific extenstions.
 	</para>
 	<section id="sect-Hibernate_EntityManager_User_Guide-EJB_QL_The_Object_Query_Language-Case_Sensitivity">
 		<title>Case Sensitivity</title>
@@ -220,7 +220,7 @@
 			</listitem>
 		</itemizedlist>
 		<para>
-			You may use arithmetic operators, concatenation, and recognized SQL functions in the select clause (dpending on configured dialect, HQL specific feature):
+			You may use arithmetic operators, concatenation, and recognized SQL functions in the select clause (depending on configured dialect, HQL specific feature):
 		</para>
 		
 <programlisting>select cat.weight + sum(kitten.weight) 
@@ -528,7 +528,7 @@
 <programlisting>select cat from Show show where 'fizard' in indices(show.acts)
 </programlisting>
 		<para>
-			Note that these constructs - <literal>size</literal>, <literal>elements</literal>, <literal>indices</literal>, <literal>minindex</literal>, <literal>maxindex</literal>, <literal>minelement</literal>, <literal>maxelement</literal> - may only be used in the where clause in Hibernate3.
+			Note that these constructs - <literal>size</literal>, <literal>elements</literal>, <literal>indices</literal>, <literal>minindex</literal>, <literal>maxindex</literal>, <literal>minelement</literal>, <literal>maxelement</literal> - may only be used in the where clause in Hibernate.
 		</para>
 		<para>
 			In HQL, elements of indexed collections (arrays, lists, maps) may be referred to by index (in a where clause only):
@@ -718,7 +718,7 @@
 	<section id="sect-Hibernate_EntityManager_User_Guide-EJB_QL_The_Object_Query_Language-EJB_QL_examples">
 		<title>EJB-QL examples</title>
 		<para>
-			Hibernate queries can be quite powerful and complex. In fact, the power of the query language is one of Hibernate's (and now EJB-QL's) main selling points. Here are some example queries very similar to queries that I used on a recent project. Note that most queries you will write are much simpler than these!
+			Hibernate queries can be quite powerful and complex. In fact, the power of the query language is one of Hibernate's (and now EJB-QL's) main selling points. The following queries are examples. Note that most queries you will write are much simpler than these!
 		</para>
 		<para>
 			The following query returns the order id, number of items and total value of the order for all unpaid orders for a particular customer and given minimum total value, ordering the results by total value. In determining the prices, it uses the current catalog. The resulting SQL query, against the <literal>ORDER</literal>, <literal>ORDER_LINE</literal>, <literal>PRODUCT</literal>, <literal>CATALOG</literal> and <literal>PRICE</literal> tables has four inner joins and an (uncorrelated) subselect.
@@ -733,18 +733,18 @@
 where order.paid = false
     and order.customer = :customer
     and price.product = product
-    and catalog.effectiveDate &lt; sysdate
+    and catalog.effectiveDate &lt; current_date()
     and catalog.effectiveDate &gt;= all (
         select cat.effectiveDate 
         from Catalog as cat
-        where cat.effectiveDate &lt; sysdate
+        where cat.effectiveDate &lt; current_date()
     )
 group by order
 having sum(price.amount) &gt; :minAmount
 order by sum(price.amount) desc
 </programlisting>
 		<para>
-			What a monster! Actually, in real life, I'm not very keen on subqueries, so my query was really more like this:
+			An alternative method to using subqueries would be:
 		</para>
 		
 <programlisting>select order.id, sum(price.amount), count(item)
@@ -782,7 +782,7 @@
 order by status.sortOrder
 </programlisting>
 		<para>
-			If I would have mapped the <literal>statusChanges</literal> collection as a list, instead of a set, the query would have been much simpler to write.
+			If the <literal>statusChanges</literal> collection were mapped as a list instead of a set, the query would be far simpler, but HQL-specific:
 		</para>
 		
 <programlisting>select count(payment), status.name 
@@ -793,10 +793,8 @@
 group by status.name, status.sortOrder
 order by status.sortOrder
 </programlisting>
+
 		<para>
-			However the query would have been HQL specific.
-		</para>
-		<para>
 			The next query uses the MS SQL Server <literal>isNull()</literal> function to return all the accounts and unpaid payments for the organization to which the current user belongs. It translates to an SQL query with three inner joins, an outer join and a subselect against the <literal>ACCOUNT</literal>, <literal>PAYMENT</literal>, <literal>PAYMENT_STATUS</literal>, <literal>ACCOUNT_TYPE</literal>, <literal>ORGANIZATION</literal> and <literal>ORG_USER</literal> tables.
 		</para>
 		

Modified: projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Native_query.xml
===================================================================
--- projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Native_query.xml	2010-03-30 06:56:15 UTC (rev 103234)
+++ projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/Native_query.xml	2010-03-30 06:57:20 UTC (rev 103235)
@@ -5,12 +5,12 @@
 <chapter id="chap-Hibernate_EntityManager_User_Guide-Native_query">
 	<title>Native query</title>
 	<para>
-		You may also express queries in the native SQL dialect of your database. This is useful if you want to utilize database-specific features such as query hints or the CONNECT BY option in Oracle. It also provides a clean migration path from a direct SQL/JDBC based application to Hibernate. Note that Hibernate3 allows you to specify handwritten SQL (including stored procedures) for all create, update, delete, and load operations (please refer to the reference guide for more information.)
+		You may also express queries in the native SQL dialect of your database. This is useful if you want to utilize database-specific features such as query hints or the CONNECT BY option in Oracle. It also provides a clean migration path from a direct SQL/JDBC based application to Hibernate. Note that Hibernate allows you to specify handwritten SQL (including stored procedures) for all create, update, delete, and load operations (please refer to the reference guide for more information.)
 	</para>
 	<section id="sect-Hibernate_EntityManager_User_Guide-Native_query-Expressing_the_resultset">
 		<title>Expressing the resultset</title>
 		<para>
-			To use a SQL query, you need to describe the SQL resultset, this description will help the <literal>EntityManager</literal> to map your columns onto entity properties. This is done using the <literal>@SqlResultSetMapping</literal> annotation. Each <literal>@SqlResultSetMapping </literal>has a name which is used when creating a SQL query on <literal>EntityManager</literal>.
+			To use a SQL query, you need to describe the SQL resultset. This description will help the <literal>EntityManager</literal> to map your columns onto entity properties. This is done using the <literal>@SqlResultSetMapping</literal> annotation. Each <literal>@SqlResultSetMapping </literal>has a name which is used when creating a SQL query on <literal>EntityManager</literal>.
 		</para>
 		
 		<programlisting language="Java"><xi:include href="extras/Code_Example_8-1.java" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include></programlisting>

Modified: projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-1.java
===================================================================
--- projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-1.java	2010-03-30 06:56:15 UTC (rev 103234)
+++ projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-1.java	2010-03-30 06:57:20 UTC (rev 103235)
@@ -1,17 +1,18 @@
 @SqlResultSetMapping(name="GetNightAndArea", entities={
-    @EntityResult(name="org.hibernate.test.annotations.query.Night", fields = {
-        @FieldResult(name="id", column="nid"),
-        @FieldResult(name="duration", column="night_duration"),
-        @FieldResult(name="date", column="night_date"),
-        @FieldResult(name="area", column="area_id")
-    }),
-    @EntityResult(name="org.hibernate.test.annotations.query.Area", fields = {
-        @FieldResult(name="id", column="aid"),
-        @FieldResult(name="name", column="name")
-    })
-    }
+ at EntityResult(entityClass=org.hibernate.test.annotations.query.Night.class, fields
+= {
+ at FieldResult(name="id", column="nid"),
+ at FieldResult(name="duration", column="night_duration"),
+ at FieldResult(name="date", column="night_date"),
+ at FieldResult(name="area", column="area_id")
+}),
+ at EntityResult(entityClass=org.hibernate.test.annotations.query.Area.class, fields
+= {
+ at FieldResult(name="id", column="aid"),
+ at FieldResult(name="name", column="name")
+})
+}
 )
 
-//or
- at SqlResultSetMapping(name="defaultSpaceShip", 
-entities=@EntityResult(name="org.hibernate.test.annotations.query.SpaceShip"))
\ No newline at end of file
+ at SqlResultSetMapping(name="defaultSpaceShip",
+entities=@EntityResult(entityClass=org.hibernate.test.annotations.query.SpaceShip.class))

Modified: projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-2.java
===================================================================
--- projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-2.java	2010-03-30 06:56:15 UTC (rev 103234)
+++ projects/docs/enterprise/4.3.8/Hibernate/Hibernate_EntityManager_User_Guide/en-US/extras/Code_Example_8-2.java	2010-03-30 06:57:20 UTC (rev 103235)
@@ -1,17 +1,19 @@
- at SqlResultSetMapping(name="ScalarAndEntities", 
-    entities={
-        @EntityResult(name="org.hibernate.test.annotations.query.Night", fields = {
-            @FieldResult(name="id", column="nid"),
-            @FieldResult(name="duration", column="night_duration"),
-            @FieldResult(name="date", column="night_date"),
-            @FieldResult(name="area", column="area_id")
-        }),
-        @EntityResult(name="org.hibernate.test.annotations.query.Area", fields = {
-            @FieldResult(name="id", column="aid"),
-            @FieldResult(name="name", column="name")
-        })
-    },
-    columns={
-        @ColumnResult(name="durationInSec")
-    }
-)
\ No newline at end of file
+ at SqlResultSetMapping(name="ScalarAndEntities",
+entities={
+ at EntityResult(entityClass=org.hibernate.test.annotations.query.Night.class,
+fields = {
+ at FieldResult(name="id", column="nid"),
+ at FieldResult(name="duration", column="night_duration"),
+ at FieldResult(name="date", column="night_date"),
+ at FieldResult(name="area", column="area_id")
+}),
+ at EntityResult(entityClass=org.hibernate.test.annotations.query.Area.class,
+fields = {
+ at FieldResult(name="id", column="aid"),
+ at FieldResult(name="name", column="name")
+})
+},
+columns={
+ at ColumnResult(name="durationInSec")
+}
+)




More information about the jboss-cvs-commits mailing list