kochcp wrote:
order-by="company_name asc"
put that in the collection definition, hibernate will tag that on the end of the sql query and use a LinkedHashSet, which preserves order but still keeps most of the properties of a Set
I thought I had tried this one before... I receive the error 'Invalid column name 'company_name'
Here is what I changed the <set> element too.
<set name="companies" table="contact_company_map" order-by="company_name">
<key column="contact_id"/>
<many-to-many column="company_id" class="beans.CompanyBean"/>
</set>
Thanks,
Eric
DEBUG [http-8080-Processor24] 434807ms 2006-Mar-16 21:16:11 org.hibernate.util.JDBCExceptionReporter - could not initialize a collection: [com.spx.itcontacts.beans.ContactBean.companies#182] [select companies0_.contact_id as contact2_1_, companies0_.company_id as company1_1_, companybea1_.company_id as company1_0_, companybea1_.COMPANY_NAME as COMPANY2_0_0_, companybea1_.address1 as address3_0_0_, companybea1_.address2 as address4_0_0_, companybea1_.city as city0_0_, companybea1_.stateOrProvince as stateOrP6_0_0_, companybea1_.postalCode as postalCode0_0_, companybea1_.country as country0_0_, companybea1_.telephoneNumber as telephon9_0_0_ from contact_company_map companies0_ inner join company companybea1_ on companies0_.company_id=companybea1_.company_id where companies0_.contact_id=? order by companies0_.company_name]
java.sql.SQLException: Invalid column name 'company_name'.