Skip to content
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

Bug: Wrong join in query with @Inheritance and @DbForeignKey #2580

Merged

Conversation

AlexWagner
Copy link
Contributor

@AlexWagner AlexWagner commented Mar 2, 2022

Bug: Wrong join in query with @ Inheritance and @DbForeignKey

Query was:
select t0.dtype, t0.id, t0.accessor_id, t0.principal_id, t2.dtype, t0.account_account_number, t0.accessor_id, t2.dtype, t0.account_account_number, t1.id, t1.name, t2.dtype, t2.account_number
from access t0
left join account t2 on t2.account_number = t0.account_account_number
left join o_customer t1 on t1.id = t0.accessor_id and t2.dtype = 'B'
left join o_customer t3 on t3.id = t0.principal_id
where t1.status = ? and t3.status = ? and t0.id in (?,?,?,?,?)

Problem is that and t2.dtype = 'B' is put to the wrong join

@rbygrave rbygrave added the bug label Mar 2, 2022
rbygrave added a commit that referenced this pull request Mar 14, 2022
Effectively delays an extra join added via BeanPropertyAssocOne with inheritance, such that this only occurs if a SqlTreeNode child doesn't add the join.
@rbygrave rbygrave merged commit 8e44ad7 into ebean-orm:master Mar 14, 2022
@rbygrave rbygrave self-assigned this Mar 14, 2022
@rbygrave rbygrave added this to the 12.16.0 milestone Mar 14, 2022
@rPraml rPraml deleted the Bug-wrong-join-inheritance-dbforeignkey branch August 10, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants