From 4cdc1e23f56d7330c97b8a8716e95e232bb81de4 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Mon, 4 Jul 2005 02:41:38 +0000 Subject: [PATCH] docd aliasesless sql queries git-svn-id: https://svn.jboss.org/repos/hibernate/trunk/Hibernate3/doc@7366 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- reference/en/modules/query_sql.xml | 42 +++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/reference/en/modules/query_sql.xml b/reference/en/modules/query_sql.xml index 48afabf680..87a3bd99ff 100644 --- a/reference/en/modules/query_sql.xml +++ b/reference/en/modules/query_sql.xml @@ -13,17 +13,45 @@ all create, update, delete, and load operations. - - Creating a native SQL <literal>Query</literal> + + Using a <literal>SQLQuery</literal> - SQL queries are controlled via the SQLQuery interface, which - is obtained by calling Session.createSQLQuery(). + Execution of native SQL queries is controlled via the SQLQuery interface, + which is obtained by calling Session.createSQLQuery(). In extremely + simple cases, we can use the following form: + + + + + + This query specified: + + + + + + the SQL query string + + + + + the entity returned by the query + + + + + + Here, the result set column names are assumed to be the same as the column names + specified in the mapping document. This can be problematic for SQL queries which + join multiple tables, since the same column names may appear in more than one + table. The following form is not vulnerable to column name duplication: @@ -44,8 +72,8 @@ - The addEntity() method associates SQL table aliases with entity classes, - and determines the shape of the query result set. + The addEntity() method associates the SQL table alias with the returned + entity class, and determines the shape of the query result set.