mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-08 10:49:37 +00:00
updated docs to reflect the changes to scalar-query
git-svn-id: https://svn.jboss.org/repos/hibernate/trunk/Hibernate3/doc@5301 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
c6702ea0a6
commit
a9a5787af5
@ -106,22 +106,17 @@ List loggedCats = sess.createSQLQuery(sql, "cat", Cat.class)
|
||||
|
||||
<para>
|
||||
Using named SQL queries, you may also query for scalar values. To do this, use the type attribute
|
||||
of the return element and specify a Hibernate type there:
|
||||
of the <literal><scalar-return></literal> element and specify a type there:
|
||||
</para>
|
||||
|
||||
<programlisting><![CDATA[<sql-query name="mySqlQuery">
|
||||
<return alias="name" type="string"/>
|
||||
<return alias="age" type="long"/>
|
||||
SELECT p.NAME AS {name},
|
||||
p.AGE AS {age},
|
||||
<scalar-return column="name" type="string"/>
|
||||
<scalar-return column="age" type="long"/>
|
||||
SELECT p.NAME AS name,
|
||||
p.AGE AS age,
|
||||
FROM PERSON p WHERE p.NAME LIKE 'Hiber%'
|
||||
</sql-query>]]></programlisting>
|
||||
|
||||
<para>
|
||||
You can also use custom types and typedefs you defined in the type attribute (remember that
|
||||
the mapping file containing the typedefs has to be added earlier to the configuration).
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="querysql-cud">
|
||||
|
Loading…
x
Reference in New Issue
Block a user