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 know this particular query is not very useful and serves for demonstration purposes only.)
This results in the following SQL.
selectthis_.idas id1_0_0_, this_.versionas version2_0_0_, this_.nameas name3_0_0_
from author this_
wherethis_.idin (selectthis_.idas y0_
from author this_
inner join book books_alia1_ onthis_.id=books_alia1_.author_idwhere ((books_alia1_.name is nullorlower(books_alia1_.name) like ?)))
Note that the books in the subquery are now joined with an INNER JOIN instead of a LEFT JOIN which is what one would expect.
Expected Behaviour
The books in the subquery should also be joined with a left join, if configured so with a join('books, JoinType.LEFT).
Actual Behaviour
The LEFT JOIN specification is not considered in subqueries
Environment Information
Operating System: macOS
GORM Version: 7.0.8 (but the error already occurs in 6.1.10 and a backport to 6.x would be appreciated 🙏 )
Grails Version (if using Grails): 4.0.6
JDK Version: 1.8.0_231
Example Application
Example application with an integration test which should pass:
Steps to Reproduce
The following query
is executed with the following SQL code
which is what is expected. Note that the books are joined using a LEFT OUTER JOIN.
If I now take the exact same DetachedCriteria and use it as a sub query in an other DetachedCriteria as follows
(I know this particular query is not very useful and serves for demonstration purposes only.)
This results in the following SQL.
Note that the books in the subquery are now joined with an INNER JOIN instead of a LEFT JOIN which is what one would expect.
Expected Behaviour
The books in the subquery should also be joined with a left join, if configured so with a
join('books, JoinType.LEFT)
.Actual Behaviour
The LEFT JOIN specification is not considered in subqueries
Environment Information
Example Application
Example application with an integration test which should pass:
https://github.com/timaebi/gorm-subquerry-left-join-issue
The text was updated successfully, but these errors were encountered: