-->
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.  [ 4 posts ] 
Author Message
 Post subject: AddOrder on associations doesn't seem to work properly
PostPosted: Tue Oct 25, 2005 4:15 pm 
I have a "Task" type which has a property "Status" ("Status" type) that is a many-to-one association. I cannot for the life of me figure out how to sort Tasks using any properties on the Status class.

Using the following code throws this exception "could not resolve property:Status.Name of :Task"

ICriteria criteria = session.CreateCriteria( typeof( Task ) );
criteria.CreateCriteria( "Status", "Status" );
IList list = criteria.AddOrder( Order.Asc( "Status.Name" ) ).List( );

Would love any ideas or advice (besides coding the same query in HQL). Please let me know if I am doing something incorrectly.


Top
  
 
 Post subject: Additional information
PostPosted: Wed Oct 26, 2005 8:26 am 
This would be the corresponding T-SQL statement for what I am trying to accomplish...

SELECT * FROM task LEFT OUTER JOIN status ON task.status = status.id ORDER BY status.name

Is this possible in NHibernate?


Top
  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 10:01 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
I don't think there's a way to do what you want using criteria queries. Use HQL.


Top
 Profile  
 
 Post subject: Thanks for your response.
PostPosted: Wed Oct 26, 2005 10:28 am 
Sergey,

Thanks for the prompt response. I will try this using HQL.

If it makes sense to the project team, I would say that this functionalty would be a *very nce* addition to NHibernate.

However, I am in software development myself, and understand that sometimes the wants/needs of one customer may not match the direction of the greater customer base.

Anyways, keep up the great work!


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

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.