diff --git a/build-common/NHibernate.props b/build-common/NHibernate.props index 5f3af514360..d9232862553 100644 --- a/build-common/NHibernate.props +++ b/build-common/NHibernate.props @@ -3,9 +3,9 @@ 5.3 - 14 + 15 - + dev $(NhVersion).$(VersionPatch) $(VersionSuffix).$(BuildNumber) diff --git a/src/NHibernate.Test/Async/Hql/EntityJoinHqlTest.cs b/src/NHibernate.Test/Async/Hql/EntityJoinHqlTest.cs index b8c1e497cae..65d0459ef3d 100644 --- a/src/NHibernate.Test/Async/Hql/EntityJoinHqlTest.cs +++ b/src/NHibernate.Test/Async/Hql/EntityJoinHqlTest.cs @@ -359,6 +359,9 @@ from x2 in session.Query() var withNullOrValidList = await (session.Query().Where(x => x.ManyToOne.Id == validManyToOne.Id || x.ManyToOne == null).ToListAsync()); var withNullOrValidList2 = await (session.Query().Where(x => x.ManyToOne == null || x.ManyToOne.Id == validManyToOne.Id).ToListAsync()); + //GH-3185 + var mixImplicitAndLeftJoinList = await (session.Query().Where(x => x.ManyToOne.Id == validManyToOne.Id && x.OneToOne == null).ToListAsync()); + Assert.That(fullList.Count, Is.EqualTo(2)); Assert.That(withValidManyToOneList.Count, Is.EqualTo(0)); Assert.That(withValidManyToOneList2.Count, Is.EqualTo(0)); @@ -366,6 +369,7 @@ from x2 in session.Query() Assert.That(withNullManyToOneJoinedList.Count, Is.EqualTo(2)); Assert.That(withNullOrValidList.Count, Is.EqualTo(2)); Assert.That(withNullOrValidList2.Count, Is.EqualTo(2)); + Assert.That(mixImplicitAndLeftJoinList.Count, Is.EqualTo(1)); } } diff --git a/src/NHibernate.Test/Hql/EntityJoinHqlTest.cs b/src/NHibernate.Test/Hql/EntityJoinHqlTest.cs index 085b7e6d877..607e1e80cb8 100644 --- a/src/NHibernate.Test/Hql/EntityJoinHqlTest.cs +++ b/src/NHibernate.Test/Hql/EntityJoinHqlTest.cs @@ -347,6 +347,9 @@ from x2 in session.Query() var withNullOrValidList = session.Query().Where(x => x.ManyToOne.Id == validManyToOne.Id || x.ManyToOne == null).ToList(); var withNullOrValidList2 = session.Query().Where(x => x.ManyToOne == null || x.ManyToOne.Id == validManyToOne.Id).ToList(); + //GH-3185 + var mixImplicitAndLeftJoinList = session.Query().Where(x => x.ManyToOne.Id == validManyToOne.Id && x.OneToOne == null).ToList(); + Assert.That(fullList.Count, Is.EqualTo(2)); Assert.That(withValidManyToOneList.Count, Is.EqualTo(0)); Assert.That(withValidManyToOneList2.Count, Is.EqualTo(0)); @@ -354,6 +357,7 @@ from x2 in session.Query() Assert.That(withNullManyToOneJoinedList.Count, Is.EqualTo(2)); Assert.That(withNullOrValidList.Count, Is.EqualTo(2)); Assert.That(withNullOrValidList2.Count, Is.EqualTo(2)); + Assert.That(mixImplicitAndLeftJoinList.Count, Is.EqualTo(1)); } } diff --git a/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElement.cs b/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElement.cs index fa4796baebc..d32fbffb44a 100644 --- a/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElement.cs +++ b/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElement.cs @@ -590,13 +590,13 @@ public void SetOrigin(FromElement origin, bool manyToMany) } else { - if (!Walker.IsInFrom && !Walker.IsInSelect) + if (Walker.IsInFrom || Walker.IsInSelect || (this.IsImplied && !this.JoinSequence.IsThetaStyle)) { - FromClause.AddChild(this); + origin.AddChild(this); } else { - origin.AddChild(this); + FromClause.AddChild(this); } } }