Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Jpa joins #1085
Implicit joins are those where the synthesized foreign key is selected from a table. At the JPA level this requires navigating the relationship to the related entity and getting its id. Existing behavior does an inner join which means any case where the relation is null would simply exclude that row from results. This is incorrect behavior. It should instead allow the null value to be returned. Hence left outer join. Inner join behavior can be had by explicitly specifiying the join in the SQL.
…/right. The names customer/address were messing with my head when trying to reason about this code. My guess is the customer/address names leaked from the test case ddl.
It's not clear to me what this is trying to accomplish. The *ToOne side of a relationship is handled by addSingularAttributes. The ManyToMany case would surely need a join table created, which this method does not do. The OneToMany which this method tries to do something with is unnecessary as far as I can reason, and it results in an explosion of row results because of joining the relationship in even the simplist of query (select * from entity).
Old behavior uses a relation's PK as the name of the FK column in the parent. If the entities happen to use the same name for their IDs you get a collision and only one column ends up exposed. I for one always name my entity ids 'id'. This change instead names the FK column(s) $parentAttribute_$childIdProperty.
…ties. These properties are added to FK columns so downstream processing knows the parent attribute and the child id property associated with the column. This is necessary for disambiguating joins.
Old behavior matches up joins based table names or table metadata matching. This does not work when the same entity is joined multiple times. Eg, two properties have the same entity type or a parent->child relationship is joined. Instead, the RELATION_* properties are used to match joins up by parent attribute names and child id.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.