-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
DDC-2131: Fetch join not working on class table inheritance #2819
Comments
Issue was closed with resolution "Duplicate" |
Comment created by @beberlei: This is not easy to fix as you can see DDC-1256 is open for a while. However in your case there is an easy solution, why not fetch the appointment form by id, and then go the association to the appointment? This is the inverse operation on that relation, but suits your needs perfectly. |
Comment created by gseric: Benjamin, this issue is duplicate of duplicate (according to your status changes). So original issues is DDC-349, but this error was introduced in 2.3. DDC-349 was created way back in 2010 so it can't be the same problem. As far as I can tell, the problem was introduced with "Arbitrary join support" feature: You can see it clearly in this issue's description: This issue can't be easily avoided in situation where you want to SELECT only one child row per parent row (based on some condition). WITH is natural and fastest option. |
Comment created by gseric: This bug seems to be recognized and fixed (pull request ATM) in DDC-2506 |
Comment created by @doctrinebot: |
Comment created by strate: Why do you think that applying ON/WITH conditions only to base table is good? What if I will reference to fields from child entity in ON/WITH clause? |
Comment created by strate: |
Comment created by @doctrinebot: |
Comment created by @doctrinebot: A related Github Pull-Request [GH-708] was closed: |
Comment created by @doctrinebot: A related Github Pull-Request [GH-708] was assigned: |
Jira issue originally created by user alsar:
I have an entity Appointment, that is associated with application forms.
I have an abstract class AbstractApplicationForm that has multiple (6) child classes.
The mapping info for the abstract application form looks like this:
I have an OneToMany connection from Appointment to AbstractApplicationForm.
When i construct an DQL, to get an appointment with only specific application forms it gets wrong translated into SQL.
For instance if the query builder looks like this:
So with this dql i should get an appointment with filtered application forms. In this case it whould return an appointment with only one application form (that with the id 123456789).
But it returns all associated application form instead on only that with the id 123456789, because it ignores the with clause.
Here is the SQL that gets generated from the DQL:
The problem i see here is that the AND is added to the last join (applicationform_opzdvzu). But it should added to the first join (applicationform). Because the first join represents the parent entity (AbstractApplicationForm).
There is also a problem in the FROM clause. The problem is that program_execution_activity_appointment p8_ is never used anywhere else, except in the from clause.
The generated query should look like this:
This sql works as expected.
I hope i was clear enough what the problem is.
The text was updated successfully, but these errors were encountered: