Description

This query:

var orderedQueryable = this.participationRequests .Fetch(x => x.CommunityEvent) .Fetch(x => x.CommunityMember) .ThenFetch(x => x.User) .Where(x => x.CommunityMember.Community.Id == communityId) .OrderBy(x => x.CreateDate);

Produces the following SQL:

select * from ParticipationRequests participat0_ left outer join CommunityEvents communitye1_ on participat0_.CommunityEventId = communitye1_.Id left outer join CommunityMembers communitym2_ on participat0_.CommunityMemberId = communitym2_.Id left outer join Users user3_ on communitym2_.UserId = user3_.Id inner join CommunityMembers communitym4_ on participat0_.CommunityMemberId = communitym4_.Id inner join CommunityMembers communitym5_ on participat0_.CommunityMemberId = communitym5_.Id inner join Communities community6_ on communitym5_.CommunityId = community6_.Id where community6_.Id = 2002 /* @p0 */ order by participat0_.CreateDate asc

It generates left outer join and inner join, should be only one of them

Some additional links:

http://stackoverflow.com/questions/8152298/linq-to-nhibernate-duplicates-joins
http://stackoverflow.com/questions/10104949/nhibernate-generating-outer-join-for-a-fetch

Environment

None

Attachments

2
  • 13 Apr 2012, 06:53 AM
  • 12 Apr 2012, 02:14 PM

Activity

Show:

Alex Zaytsev September 8, 2020 at 9:22 PM

Moved here.

Andrey Kozhyn April 13, 2012 at 6:53 AM

Same in 3.3.0CR1. Added a new test case for new version

Alex Zaytsev April 12, 2012 at 3:58 PM

Could you please check with NH 3.3.0CR1?

Andrey Kozhyn April 12, 2012 at 2:14 PM

Here is a test case for this issue

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Alex Zaytsev

Reporter

Andrey Kozhyn

Components

Fix versions

Affects versions

Priority

Major

Who's Looking?

Open Who's Looking?
Created April 12, 2012 at 1:36 PM
Updated September 14, 2020 at 11:06 PM
Resolved September 8, 2020 at 9:22 PM
Who's Looking?