Skip to content

Commit f1ffb24

Browse files
schauderSergiiTsypanov
authored andcommitted
DATAJPA-1418 - Polishing.
Added comment with issue id on the test. Added a comment with a link to the Hibernate issue. Original pull request: spring-projects#294.
1 parent 10134a8 commit f1ffb24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java

+3
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ private static boolean requiresJoin(@Nullable Bindable<?> propertyPathModel, boo
633633
return false;
634634
}
635635

636+
// if this path is part of the select list we need to generate an explicit outer join in order to prevent Hibernate
637+
// to use an inner join instead.
638+
// see https://hibernate.atlassian.net/browse/HHH-12999.
636639
if (isLeafProperty && !isForSelection && !attribute.isCollection()) {
637640
return false;
638641
}

src/test/java/org/springframework/data/jpa/repository/projections/ProjectionJoinIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ProjectionJoinIntegrationTests {
4747

4848
@Autowired private UserRepository userRepository;
4949

50-
@Test
50+
@Test // DATAJPA-1418
5151
public void findByIdPerformsAnOuterJoin() {
5252
User user = userRepository.save(new User());
5353

0 commit comments

Comments
 (0)