@@ -22,6 +22,7 @@ public class AddJoinsReWriter : NhQueryModelVisitorBase, IIsEntityDecider, INhQu
2222 private readonly MemberExpressionJoinDetector _memberExpressionJoinDetector ;
2323 private readonly WhereJoinDetector _whereJoinDetector ;
2424 private JoinClause _currentJoin ;
25+ private bool ? _innerJoin ;
2526
2627 private AddJoinsReWriter ( ISessionFactoryImplementor sessionFactory , QueryModel queryModel )
2728 {
@@ -64,10 +65,15 @@ public override void VisitNhHavingClause(NhHavingClause havingClause, QueryModel
6465
6566 public void VisitNhOuterJoinClause ( NhOuterJoinClause nhOuterJoinClause , QueryModel queryModel , int index )
6667 {
67- VisitJoinClause ( nhOuterJoinClause . JoinClause , queryModel , nhOuterJoinClause ) ;
68+ VisitJoinClause ( nhOuterJoinClause . JoinClause , false ) ;
6869 }
6970
7071 public override void VisitJoinClause ( JoinClause joinClause , QueryModel queryModel , int index )
72+ {
73+ VisitJoinClause ( joinClause , true ) ;
74+ }
75+
76+ private void VisitJoinClause ( JoinClause joinClause , bool innerJoin )
7177 {
7278 joinClause . InnerSequence = _whereJoinDetector . Transform ( joinClause . InnerSequence ) ;
7379
@@ -79,8 +85,10 @@ public override void VisitJoinClause(JoinClause joinClause, QueryModel queryMode
7985 // support them).
8086 // Link newly created joins with the current join clause in order to later detect which join type to use.
8187 _currentJoin = joinClause ;
88+ _innerJoin = innerJoin ;
8289 joinClause . InnerKeySelector = _whereJoinDetector . Transform ( joinClause . InnerKeySelector ) ;
8390 _currentJoin = null ;
91+ _innerJoin = null ;
8492 }
8593
8694 public bool IsEntity ( System . Type type )
@@ -97,7 +105,7 @@ public bool IsIdentifier(System.Type type, string propertyName)
97105 private void AddJoin ( QueryModel queryModel , NhJoinClause joinClause )
98106 {
99107 joinClause . ParentJoinClause = _currentJoin ;
100- if ( _currentJoin != null )
108+ if ( _innerJoin == true )
101109 {
102110 // Match the parent join type
103111 joinClause . MakeInner ( ) ;
0 commit comments