|
Hibernate version: 1.2.0
Mapping documents:
<class name="SalesManager" table="SalesManager" lazy="false" >
<id name="ID" column="ID">
<generator class="identity" />
</id>
...
<bag name="Clients" table="Clients" inverse="true" order-by="City, Street" >
<key column="SalesManagerID" />
<one-to-many class="Client" />
</bag>
</class>
Name and version of the database you are using:
SQL Server 2005
The generated SQL (show_sql=true):
SELECT salesman0_.ID as ID__1_,
address1_.City as Address0_0_, address1_.Street as Street0_0_
FROM SalesManager salesman0_
left outer join Address address1_ on salesman0_.AddressID=address1_.ID
WHERE salesman0_.ID=?
ORDER BY salesman0_.City, salesman0_.Street] ---> System.Data.SqlClient.SqlException: Invalid column name 'City'.
I want to order a collection. The columns I want to order on are not in table Client but in table Address. The table Client is joined with table Address. Can I specify this in my mapping file?
I could sort the collection using a comparer, but I'm wondering if it also can be done in the order by attribute of a bag in my mapping file.
|