-->
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: Exception "subcriteria cannot be ordered" fix?
PostPosted: Mon May 22, 2006 8:49 am 
Senior
Senior

Joined: Sat Mar 25, 2006 9:16 am
Posts: 150
This code throws exception "subcriteria cannot be ordered". Foo and Bar are related through the mapping file. I am trying to order the results by a column in the Bar table but I am selecting Foos based on the Foo ID.

Code:
ICriteria crit = session.CreateCriteria(typeof(Foo));
crit.Add(NHibernate.Expression.Expression.Eq("FooId", 1);
crit.CreateCriteria("Bar").AddOrder(NHibernate.Expression.Order.Asc("BarName"));
IList tprList = crit.List();


How can I order by a column in a related table to the one I am basing my criteria on?

Thanks


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.