-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQL order by doesn't map property name to column name
PostPosted: Tue Nov 13, 2007 8:14 pm 
Beginner
Beginner

Joined: Thu Nov 02, 2006 5:11 pm
Posts: 32
Location: Toronto
Hibernate version: 1.2.0

Mapping documents:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="ClearCanvas.Healthcare" namespace="ClearCanvas.Healthcare">
  <class name="AddressTypeEnum" proxy="AddressTypeEnum" table="AddressTypeEnum_">
    <id name="Code" column="Code_" type="String">
      <generator class="assigned"/>
    </id>
    <property name="Value" column="Value_" type="String" length="50"/>
    <property name="Description" column="Description_" type="String" length="200"/>
    <property name="DisplayOrder" column="DisplayOrder_" type="Single"/>
  </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Code:
IQuery q = session.CreateQuery("from AddressTypeEnum order by DisplayOrder asc");
q.Find();


Name and version of the database you are using:

SQL server 2005 (but using SQL server 2000 dialect)

The generated SQL (show_sql=true):

Code:
NHibernate: select addresstyp0_.Code_ as Code1_26_, addresstyp0_.Value_ as Value2_26_, addresstyp0_.Description_ as Descript3_26_, addresstyp0_.DisplayOrder_ as
DisplayO4_26_ from Ris4.dbo.AddressTypeEnum_ addresstyp0_ order by  DisplayOrder asc


Note the order by clause. The DisplayOrder property is not mapped to the database column. Anyone know if there is a fix for this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.