Hi I have a class Contact, with fields lastName/firstName etc.. my mapping doc looks like:
Code:
<hibernate-mapping>
<class name="Contact" table="CONTACTS">
<id name="id" type="long" unsaved-value="null">
<generator class="identity"/>
</id>
<property name="email"/>
<property name="fax"/>
<property name="firstName"/>
<property name="gender"/>
<property name="lastName"/>
<property name="middleName"/>
<property name="mobileNumber"/>
<property name="note"/>
<property name="phone"/>
<property name="phoneExtension"/>
<property name="preferredName"/>
<property name="title"/>
<many-to-one name="user" column="user_id"/>
<joined-subclass name="PMSContact" table="PMSContact">
<key column="CONTACT_ID"/>
<many-to-one name="prospect" column="prospect_id" not-null="true"/>
</joined-subclass>
</class>
</hibernate-mapping>
I have another class that is one-to-many with the subclass PMSContact, I tried to have it sort on load by lastName, and it failed saying the column was not part of the object? Here's what I tried
Code:
<set name="contacts" cascade="all-delete-orphan" inverse="true" lazy="true">
<key column="prospect_id"/>
<one-to-many class="PMSContact" order-by"lastName asc"/>
</set>
Here's the error thrown from my log file:
Code:
2004-03-19 13:57:45,765 [ERROR] util.JDBCExceptionReporter - could not initialize collection: [Prospect.contacts#1]
java.sql.SQLException: Column not found, message from server: "Unknown column 'contacts0_.lastName' in 'order clause'"
Is this a limitation of ordering?
Thanks
David