I'm running the following query using NHibernate:
var query = session.QueryOver<TaskMeeting>()
.JoinQueryOver(x => x.Task)
.Where(x => x.CloseOn == null)
.List();
Which then generates the following SQL:
SELECT
this_.Id as Id89_1_,
this_.TaskMeetingTypeID as TaskMeet2_89_1_,
this_.DateTime as DateTime89_1_,
this_.Description as Descript4_89_1_,
this_.TaskID as TaskID89_1_,
ltaskalias1_.Id as Id87_0_,
ltaskalias1_.Title as Title87_0_,
ltaskalias1_.Description as Descript7_87_0_,
ltaskalias1_.CreatedOn as CreatedOn87_0_,
ltaskalias1_.LastUpdated as LastUpda9_87_0_,
ltaskalias1_.ClosedOn as ClosedOn87_0_,
FROM
dbo.[TaskMeeting] this_
inner join
dbo.[Task] ltaskalias1_
on this_.TaskID=ltaskalias1_.Id
WHERE
ltaskalias1_.ClosedOn is null
Is pulling joined table information normal behavior? I would think it should only be selecting data pertaining to the root entity unless I specify a .Fetch
clause or manually select the data.
I'm using Fluent NHibernate
for the class mappings, but they are basic mappings for something like this, no eager loading specified - just simple Map
and References
where appropriate.
I've tried removing the where clause thinking perhaps that was the cause. The additional SELECT
s continue to persist unless I remove the join itself.