-
Notifications
You must be signed in to change notification settings - Fork 934
problem with join with withClause in case of inheritance #2331
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
base: master
Are you sure you want to change the base?
Conversation
Thanks! Please add tests too. |
hi @gliljas what do I need in order to run the tests locally? I have both nunit 2 and 3 installed. For some reason the tests are not getting started. Where I can read more about the unit tests practices you're following? |
NUnit 3 is what is used. Personally I use the ReSharper test runner, but the one built into VS should work too. You should run the ShowBuildMenu.bat file in the project root. |
The issue is not yet finished. I have to add unit tests. |
Hi can someone please check what's going on with the travis? It's been in waiting status since the weekend? Thanks in advance |
This sometimes happens, and usually pushing new commit solves it. As anyway you have a conflict to resolve and new issues in CodeFactor, you have some commits to add (eventually with a rebase), so let's see if the issue remains after that. |
Hi. |
@georgi-yakimov in your issue which you have originally opened you are talking about HQL, but it seems this PR concerns only Criteria API. Can you please clarify? |
hi @hazzik the problem is that when there's inheritance select t1.*
from SomeTable t1
join Child c_1 on c_1.FK_Root_Id = t1.FK_Child_Id and c_1.IsActive = 1
join Root c_1_1 on c_1_1.Id = c_1.FK_Root_Id the result is select t1.*
from SomeTable t1
join Child c_1 on c_1.FK_Root_Id = t1.FK_Child_Id and c_1_1.IsActive = 1 -- c_1_1 is not joined yet
join Root c_1_1 on c_1_1.Id = c_1.FK_Root_Id You can check the unit tests I've added for more details |
This fix with use first/last index looks more like workaround for some real core issue. Can you explain more what's behind this fix? Also I tried to convert your query to PersonBase f = null;
var results =
session.QueryOver<UserEntityVisit>()
.JoinAlias(
x => x.PersonBase,
() => f,
JoinType.LeftOuterJoin,
Restrictions.Where(() => f.Deleted == false))
.List(); |
Also I might be wrong but it seems some of analysis described here #2094 might be related to your issue |
And of all similar properties: UtcNow, Today, and DateTimeOffset's ones. Part of nhibernate#959 Co-authored-by: maca88 <[email protected]>
Part of nhibernate#959 Co-authored-by: maca88 <[email protected]>
Fixes nhibernate#959, along with two previous commits
hey, could somebody please take a look why a required check is hanging for like a week by now? Thanks in advance |
@@ -2110,13 +2110,16 @@ public virtual int GetSubclassPropertyTableNumber(string propertyPath) | |||
return getSubclassColumnTableNumberClosure()[idx]; | |||
} | |||
}*/ | |||
int index = Array.IndexOf(SubclassPropertyNameClosure, rootPropertyName); //TODO: optimize this better! | |||
return index == -1 ? 0 : GetSubclassPropertyTableNumber(index); | |||
int index = useLastIndex |
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.
what would be the case when useLastIndex
is required to be false
?
This really looks like a workaround. It is easy to break this logic. If you add a subclass of The issue here is much deeper: only properties of the class itself are supported in the "with" clause. |
#2330 is actually also fixed by table group joins (#2545 for Criteria and #2361 for hql). So it seems this PR can be closed as replaced So problematic SQL below (taken from problem description): select t1.*
from SomeTable t1
join Child c_1 on c_1.FK_Root_Id = t1.FK_Child_Id and c_1_1.IsActive = 1 -- c_1_1 is not joined yet
join Root c_1_1 on c_1_1.Id = c_1.FK_Root_Id Become after fix: select t1.*
from SomeTable t1
join
(Child c_1 join Root c_1_1 on c_1_1.Id = c_1.FK_Root_Id) on c_1.FK_Root_Id = t1.FK_Child_Id and c_1_1.IsActive = 1 |
After having undone the fix in this PR, its tests work locally. So I have pushed the undo to check this with the CI. |
So the test case alone without any change to NHibernate current master branch succeeds. |
Fixes #2330