Skip to content

Fix Any on composite id in Select #2653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/NHibernate.Test/Async/CompositeId/CompositeIdFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

using System;
using System.Collections;
using System.Linq;
using NHibernate.Dialect;
using NUnit.Framework;
using NHibernate.Linq;

namespace NHibernate.Test.CompositeId
{
Expand Down Expand Up @@ -296,5 +298,15 @@ public async Task QueryAsync()
await (t.CommitAsync());
s.Close();
}

[Test(Description = "GH-2646")]
public async Task AnyOnCompositeIdAsync()
{
using (var s = OpenSession())
{
await (s.Query<Order>().Where(o => o.LineItems.Any()).ToListAsync());
await (s.Query<Order>().Select(o => o.LineItems.Any()).ToListAsync());
}
}
}
}
11 changes: 11 additions & 0 deletions src/NHibernate.Test/CompositeId/CompositeIdFixture.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Linq;
using NHibernate.Dialect;
using NUnit.Framework;

Expand Down Expand Up @@ -285,5 +286,15 @@ public void Query()
t.Commit();
s.Close();
}

[Test(Description = "GH-2646")]
public void AnyOnCompositeId()
{
using (var s = OpenSession())
{
s.Query<Order>().Where(o => o.LineItems.Any()).ToList();
s.Query<Order>().Select(o => o.LineItems.Any()).ToList();
}
}
}
}
1 change: 1 addition & 0 deletions src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public IList<IParameterSpecification> Parameters
void BeforeStatement(string statementName, int statementType)
{
_inFunctionCall = false;
_inCase = false;
_level++;
if (_level == 1)
{
Expand Down