You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to migrate my project from v5.2.7 to the latest 5.3.x version but apparently I've hit a potential regression / breaking change on how filters are applied.
My filter is defined like this:
configuration.AddFilterDefinition(new FilterDefinition(
LabelFilterName,
"Label IN ('A', 'B', 'C')",
new Dictionary<string, IType>(),
false));
On "simple" queries it is applied as expected, but on a more complex one it is not:
var query = from b in session.Query<OtherTable>()
join jta in session.Query<JoinTable>() on b.Id equals jta.OtherTableId
join ft in session.Query<FilteredTable>() on jta.FilteredTableId equals ft.Id
select new
{
jta.FilteredTableId,
ft.Label
};
I've attached a small repro to demonstrate the issue: on 5.2.7 both unit tests are green, but on 5.3.11 one of them fails.
It looks like #2549, excepted #2549 has been fixed in 5.3.4. The test provided here, even simplified to a single join, fails from 5.3.0 to 5.3.11.
There is one difference between #2549 tests (in PR #2550) and yours: your filter is explicitly disabled for many-to-one relations, while the default (with filter-def in hbm mappings, used by #2550) is to have it enabled. If you switch the last argument to FilterDefinition constructor to true instead of false, your tests then all pass with latest NHibernate versions.
So, for some reason, filters are no more enabled on entities fetched through arbitrary joins if the filter useManyToOne setting is disabled. This change has occurred in 5.3.0. I have not investigated what has caused this change, so I cannot tell yet if it has to be considered a regression or an undocumented breaking change.
fredericDelaporte
changed the title
Possible regression on how filters are applied to LINQ queries
Regression for filters on entity joins with many-to-one disabled
Apr 28, 2022
I'm trying to migrate my project from v5.2.7 to the latest 5.3.x version but apparently I've hit a potential regression / breaking change on how filters are applied.
My filter is defined like this:
On "simple" queries it is applied as expected, but on a more complex one it is not:
I've attached a small repro to demonstrate the issue: on 5.2.7 both unit tests are green, but on 5.3.11 one of them fails.
repro.zip
The text was updated successfully, but these errors were encountered: