OrderBy with Select throws exception

Description

The following query throws an exception in PolymorphicQuerySourceDetector.GetClassName(IASTNode querysource):

var ids = session.Query<Person>()
.OrderBy(p => p.Id)
.Skip(100).Take(201)
.Select(p => p.Id)
.ToList();

This is a major problem for me as the query is generated by a generic graphical grid-view, so i can`t workaround this.

Environment

None

Activity

Alex Zaytsev 
September 8, 2014 at 11:31 AM

Close issues resolved in 3.3.3

Oskar Berggren 
November 18, 2012 at 7:51 PM

Tests backported to 3.3.x in ebf8ceaa373fff7268bd8510a02d20e1ba67494f. The actual fix was backported under NH-3320.

Alex Zaytsev 
May 21, 2012 at 6:34 PM

Merged to master eb2d2e372af3b884d1ae4127176da33785033ce7

Oskar Berggren 
April 24, 2012 at 12:05 PM

Nothing is merged to official master yet, and it seems like basically the same thing, so I don't think we need another bug report. Alexander may have an opinion though.

David Roth 
April 24, 2012 at 12:02 PM

Thanks for the fix, just checked out the latest master and this query is working now.
Unfortunately the query-engine we are bound to (a DevExpress GridView in Server-Mode), does in some conditions generate queries where the select query-part is at the end (after the skip,take)

So the following query still fails (NotSupportedException in PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource)):

session.Query<Person>()
.OrderBy(x => x.Forename)
.Skip(100).Take(200)
.Select(x => x.Id).ToList();

It would be awesome if Nhibernate would support this expression ordering too.
Any chance for fixing this? Should I fill a new bug report?

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created March 28, 2012 at 12:16 PM
Updated September 8, 2014 at 11:31 AM
Resolved May 21, 2012 at 6:34 PM
Who's Looking?