30.2. Legacy return-property to explicitly specify column/alias names
<div class="paragraph">
You can explicitly tell Hibernate what column aliases to use with `<return-property>`, instead of using the `{}` syntax to let Hibernate inject its own aliases.
For example:
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight">`<sql-query name = "mySqlQuery">
<return alias = "person" class = "eg.Person">
<return-property name = "name" column = "myName"/>
<return-property name = "age" column = "myAge"/>
<return-property name = "sex" column = "mySex"/>
</return>
SELECT person.NAME AS myName,
person.AGE AS myAge,
person.SEX AS mySex,
FROM PERSON person WHERE person.NAME LIKE :name
</sql-query>`</pre>
</div>
</div>
<div class="paragraph">
`<return-property>` also works with multiple columns.
This solves a limitation with the `{}` syntax which cannot allow fine grained control of multi-column properties.
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight">`<sql-query name = "organizationCurrentEmployments">
<return alias = "emp" class = "Employment">
<return-property name = "salary">
<return-column name = "VALUE"/>
<return-column name = "CURRENCY"/>
</return-property>
<return-property name = "endDate" column = "myEndDate"/>
</return>
SELECT EMPLOYEE AS {emp.employee}, EMPLOYER AS {emp.employer},
STARTDATE AS {emp.startDate}, ENDDATE AS {emp.endDate},
REGIONCODE as {emp.regionCode}, EID AS {emp.id}, VALUE, CURRENCY
FROM EMPLOYMENT
WHERE EMPLOYER = :id AND ENDDATE IS NULL
ORDER BY STARTDATE ASC
</sql-query>`</pre>
</div>
</div>
<div class="paragraph">
In this example `<return-property>` was used in combination with the `{}` syntax for injection.
This allows users to choose how they want to refer column and properties.
</div>
<div class="paragraph">
If your mapping has a discriminator you must use `<return-discriminator>` to specify the discriminator column.
</div>
</div>
<div class="sect2">