In the mapping below you'll notice I'm mapping a column "Service" in the database table to a column "Name" in the class. When I execute the query below though, the "ORDER BY Name" gets passed straight to the SQL, rather than being translated to "ORDER BY Service"
Have I done something wrong somewhere?
Kev
Hibernate version:
1.2.1GA
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Domain" assembly="Saturn.DAO">
<class name="Saturn.DAO.Domain.Service, Saturn.DAO" table="Services" >
<composite-id name="ID" class="Saturn.DAO.Types.DBKey">
<key-property name="Prefix"/>
<key-property name="ID"/>
</composite-id>
<property name="Name" column="Service" type="String" />
<property name="IsDepot" column="Depot" type="Boolean" />
<property name="IsQuay" column="Quay" type="Boolean" />
<property name="IsAgent" column="Agent" type="Boolean" />
<property name="IsSizeDependent" column="SizeDependent" type="Boolean" />
<property name="IsContainerInspection" column="ContainerInspection" type="Boolean" />
<property name="CantDelete" type="Boolean" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
session.CreateQuery("FROM Service ORDER BY Name").List(Of Domain.Service)()
Name and version of the database you are using:MS SQL Server 2005
The generated SQL (show_sql=true):Code:
select service0_.Prefix as Prefix3_, service0_.ID as ID3_, service0_.Service as Service3_, service0_.Depot as Depot3_, service0_.Quay as Quay3_, service0_.Agent as Agent3_, service0_.SizeDependent as SizeDepe7_3_, service0_.ContainerInspection as Containe8_3_, service0_.CantDelete as CantDelete3_
from Services service0_
order by Name