Skip to content

Combining an implicit JOIN with a LEFT JOIN which requires a WITH clause triggers an exception. #2031

Closed
@bahusoid

Description

@bahusoid

Original problematic query from hibenate issue looks like:

SELECT s.studentId, q.questionId, sa.answer
FROM Student s, Question q
LEFT JOIN s.studentAnswerList AS sa WITH sa.question.questionId = q.questionId

Test simulating such query was added here:

[Test, Ignore("Failing for unrelated reasons")]
public void CrossJoinAndWithClause()
{
//This is about complex theta style join fix that was implemented in hibernate along with entity join functionality
//https://hibernate.atlassian.net/browse/HHH-7321
using (var sqlLog = new SqlLogSpy())
using (var session = OpenSession())
{
session.CreateQuery(
"SELECT s " +
"FROM EntityComplex s, EntityComplex q " +
"LEFT JOIN s.SameTypeChild AS sa WITH sa.SameTypeChild.Id = q.SameTypeChild.Id"
).List();
}
}

NHibernate currently generates joins in wrong order

FROM fromTable
LEFT JOIN leftJoin ON leftJoin.someId = thetaJoin.someId
,  thetaJoin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions