-
Notifications
You must be signed in to change notification settings - Fork 934
Fix missing subclass discriminator in ON clause for entity joins #2600
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
Conversation
Should we wait a bit in case of other issues waiting to be reported, or release this soon, like on next Sunday? |
I would say don't wait. |
Just in case of troubles with resolving conflicts when merge to master: |
// Apply filters for entity joins and Many-To-One association | ||
var enabledForManyToOne = FilterHelper.GetEnabledForManyToOne(enabledFilters); | ||
condition = new SqlString(string.IsNullOrEmpty(on) && enabledForManyToOne.Count > 0 | ||
condition = new SqlString(string.IsNullOrEmpty(on) && (ForceFilter || enabledForManyToOne.Count > 0) | ||
? join.Joinable.FilterFragment(join.Alias, enabledForManyToOne) | ||
: on); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bahusoid,
I think we have missed something here, which could have fixed #3046 if done similarly in other places having that ForceFilter
: when true, shouldn't it filter on all enabled filters, not just on many-to-one enabled ones ?
// Apply filters for entity joins and Many-To-One association
var enabledFiltersForJoin = ForceFilter ? enabledFilters : FilterHelper.GetEnabledForManyToOne(enabledFilters);
condition = new SqlString(string.IsNullOrEmpty(on) && (enabledFiltersForJoin.Count > 0)
? join.Joinable.FilterFragment(join.Alias, enabledFiltersForJoin)
: on);
But it may not be enough, because the on
variable construction does exclude filters not enabled for many-to-one too.
// Apply filters for entity joins and Many-To-One associations | ||
if (oj.ForceFilter || enabledFiltersForManyToOne.Count > 0) | ||
{ | ||
string manyToOneFilterFragment = oj.Joinable.FilterFragment(oj.RHSAlias, enabledFiltersForManyToOne); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly:
// Apply filters for entity joins and Many-To-One associations
var enabledFiltersForJoin = oj.ForceFilter ? enabledFilters : enabledFiltersForManyToOne;
if (oj.ForceFilter || enabledFiltersForJoin.Count > 0)
{
string manyToOneFilterFragment = oj.Joinable.FilterFragment(oj.RHSAlias, enabledFiltersForJoin);
This issue affects both Criteria/QueryOver and Hql/Linq Query API. While it's regression only for LINQ case I made fix also for Criteria (as fix is quite simple).
Fixes #2599 (complete fix for #2463)