Casting a joined alias in QueryOver loses alias context and looks for property on QueryOver root

Description

If you QueryOver an entity, alias-join to a property on that entity which has an inheritance tree, and then attempt to project a property on a specific subclass of the entity, the property path loses the context of the alias and attempts to find it on the queryover root.

Pseudo code:

QueryOver<Customer>()
.JoinAlias(c => c.Order, () => orderAlias)
.SelectList(list => list.Select( () => ((SpecialOrder)orderAlias).SpecialReason);

blows up.

The equivalent in linq-nhibernate works OK which is why I think this is a bug.
Query<Customer>().Select( c => new { SpecialReason = ((SpecialOrder)c.Order).SpecialReason } );

Will attach issue zip in same format as NH Trunk issues.

Graeme

Environment

None

Attachments

1

Activity

Show:

Fabio Maulo 
July 30, 2011 at 2:11 PM

Closed after final release of NH3.2.0GA

Richard Brown 
June 4, 2011 at 12:19 PM

Fixed. Thanks for the test case.

Graeme Foster 
April 20, 2011 at 11:40 PM

Zip file in standard NH test format to illustrate problem.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 20, 2011 at 11:36 PM
Updated July 30, 2011 at 2:11 PM
Resolved June 4, 2011 at 12:19 PM
Who's Looking?