-
Notifications
You must be signed in to change notification settings - Fork 933
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,9 +193,9 @@ internal virtual JoinFragment ToJoinFragment( | |
else | ||
{ | ||
// NH Different behavior : NH1179 and NH1293 | ||
// Apply filters in Many-To-One association | ||
// 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); | ||
Comment on lines
+196
to
200
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bahusoid,
But it may not be enough, because the |
||
} | ||
|
@@ -327,5 +327,7 @@ public interface ISelector | |
internal string RootAlias => rootAlias; | ||
|
||
public ISessionFactoryImplementor Factory => factory; | ||
|
||
internal bool ForceFilter { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,7 +388,8 @@ internal void AddExplicitEntityJoinAssociation( | |
GetWithClause(path, pathAlias), | ||
Factory, | ||
enabledFilters, | ||
GetSelectMode(path)), path); | ||
GetSelectMode(path)) {ForceFilter = true}, | ||
path); | ||
AddAssociation(assoc); | ||
} | ||
|
||
|
@@ -851,8 +852,8 @@ protected JoinFragment MergeOuterJoins(IList<OuterJoinableAssociation> associati | |
{ | ||
oj.AddJoins(outerjoin); | ||
// NH Different behavior : NH1179 and NH1293 | ||
// Apply filters in Many-To-One association | ||
if (enabledFiltersForManyToOne.Count > 0) | ||
// Apply filters for entity joins and Many-To-One associations | ||
if (oj.ForceFilter || enabledFiltersForManyToOne.Count > 0) | ||
{ | ||
string manyToOneFilterFragment = oj.Joinable.FilterFragment(oj.RHSAlias, enabledFiltersForManyToOne); | ||
Comment on lines
+855
to
858
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly:
|
||
bool joinClauseDoesNotContainsFilterAlready = | ||
|
Uh oh!
There was an error while loading. Please reload this page.