rename result- to return-

git-svn-id: https://svn.jboss.org/repos/hibernate/trunk/Hibernate3/doc@6232 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gavin King 2005-03-29 02:25:45 +00:00
parent abbf47ed61
commit a702efd7cd

View File

@ -138,18 +138,18 @@ List loggedCats = sess.createSQLQuery(sql)
</para> </para>
<sect2 id="propertyresults"> <sect2 id="propertyresults">
<title>Using property-result to explicitly specify column/alias names</title> <title>Using return-property to explicitly specify column/alias names</title>
<para> <para>
With <literal>&lt;property-result&gt;</literal> you can explicitly tell Hibernate what columns With <literal>&lt;return-property&gt;</literal> you can explicitly tell Hibernate what columns
to use as opposed to use <literal>{}</literal>-syntax to let Hibernate inject its own aliases. to use as opposed to use <literal>{}</literal>-syntax to let Hibernate inject its own aliases.
</para> </para>
<programlisting><![CDATA[<sql-query name="mySqlQuery"> <programlisting><![CDATA[<sql-query name="mySqlQuery">
<return alias="person" class="eg.Person"> <return alias="person" class="eg.Person">
<property-result name="name" column="myName"/> <return-property name="name" column="myName"/>
<property-result name="age" column="myAge"/> <return-property name="age" column="myAge"/>
<property-result name="sex" column="mySex"/> <return-property name="sex" column="mySex"/>
</return> </return>
SELECT person.NAME AS myName, SELECT person.NAME AS myName,
person.AGE AS myAge, person.AGE AS myAge,
@ -158,16 +158,16 @@ List loggedCats = sess.createSQLQuery(sql)
</sql-query> </sql-query>
]]></programlisting> ]]></programlisting>
<literal>&lt;property-result&gt;</literal> also works with multiple columns. This solves a limitation with <literal>&lt;return-property&gt;</literal> also works with multiple columns. This solves a limitation with
the <literal>{}</literal>-syntax which can not allow fine grained control of multi-column properties. the <literal>{}</literal>-syntax which can not allow fine grained control of multi-column properties.
<programlisting><![CDATA[<sql-query name="organizationCurrentEmployments"> <programlisting><![CDATA[<sql-query name="organizationCurrentEmployments">
<return alias="emp" class="Employment"> <return alias="emp" class="Employment">
<property-result name="salary"> <return-property name="salary">
<result-column name="VALUE"/> <return-column name="VALUE"/>
<result-column name="CURRENCY"/> <return-column name="CURRENCY"/>
</property-result> </return-property>
<property-result name="endDate" column="myEndDate"/> <return-property name="endDate" column="myEndDate"/>
</return> </return>
SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer}, SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},
STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate}, STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},
@ -178,7 +178,7 @@ List loggedCats = sess.createSQLQuery(sql)
</sql-query>]]></programlisting> </sql-query>]]></programlisting>
<para> <para>
Notice that in this example we used <literal>&lt;property-result&gt;</literal> in combination Notice that in this example we used <literal>&lt;return-property&gt;</literal> in combination
with the <literal>{}</literal>-syntax for injection. Allowing users to choose with the <literal>{}</literal>-syntax for injection. Allowing users to choose
how they want to refer column and properties. how they want to refer column and properties.
</para> </para>
@ -215,16 +215,16 @@ BEGIN
<programlisting><![CDATA[<sql-query name="selectAllEmployees_SP" callable="true"> <programlisting><![CDATA[<sql-query name="selectAllEmployees_SP" callable="true">
<return alias="emp" class="Employment"> <return alias="emp" class="Employment">
<property-result name="employee" column="EMPLOYEE"/> <return-property name="employee" column="EMPLOYEE"/>
<property-result name="employer" column="EMPLOYER"/> <return-property name="employer" column="EMPLOYER"/>
<property-result name="startDate" column="STARTDATE"/> <return-property name="startDate" column="STARTDATE"/>
<property-result name="endDate" column="ENDDATE"/> <return-property name="endDate" column="ENDDATE"/>
<property-result name="regionCode" column="REGIONCODE"/> <return-property name="regionCode" column="REGIONCODE"/>
<property-result name="id" column="EID"/> <return-property name="id" column="EID"/>
<property-result name="salary"> <return-property name="salary">
<result-column name="VALUE"/> <return-column name="VALUE"/>
<result-column name="CURRENCY"/> <return-column name="CURRENCY"/>
</property-result> </return-property>
</return> </return>
{ ? = call selectAllEmployments() } { ? = call selectAllEmployments() }
</sql-query>]]></programlisting> </sql-query>]]></programlisting>