As you can see NHibernate choses to join on Rooms to get the correct Room for the SELECT, however it then chooses to add the entire table again (,Rooms Rooms2_) and then in the where clause it filters the results, effectively changing this to a INNER JOIN AND joining on the same table twice also seems like a waste.

The objects are very simply
public class Reservation {
public int ID

{ get;set; }
public Room SelectedRoom { get;set; }

}
public class Room {
public int ID

{ get;set; }
public bool ShowInList { get;set; }

}

Attachments

Issue links

is related to

NH-2946
Superfluous join when querying by foreign key given Id with LINQ