views:

52

answers:

1

With a SQL Query I can order by N, where N is a column index. For example

 SELECT name, salary FROM employee ORDER BY 2;

How can I do this with nHibernate?

A: 

You can't. NHibernate order by clause requires property names (aliases) and / or expressions to be specified.

ChssPly76
so I need fluent hibernate? (not that I know what that is)
Dead account
Fluent NHibernate is just a way to declare mappings for your entities without resorting to XML; it has nothing to do with HQL's `order by`. You cannot (nor should you as `rexem` rightly pointed out above) order by ordinals in HQL.
ChssPly76