Skip to content

Commit bc7746a

Browse files
committed
HHH-17415 Add test for issue
1 parent 017325e commit bc7746a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/query/EntityValuedPathsGroupByOrderByTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,25 @@ public void testImplicitJoinSelectAndGroupByAndOrderBy(SessionFactoryScope scope
153153
).getSingleResult().get( 1 ) ).isEqualTo( 3L ) );
154154
}
155155

156+
@Test
157+
@Jira( "https://hibernate.atlassian.net/browse/HHH-17415" )
158+
public void testInSubqueryGroupBy(SessionFactoryScope scope) {
159+
scope.inTransaction( session -> assertThat( session.createQuery(
160+
"select a from EntityA a where a.secondary in (select b2 from EntityB b2 group by b2)",
161+
Tuple.class
162+
).getResultList() ).hasSize( 2 ) );
163+
}
164+
165+
@Test
166+
@Jira( "https://hibernate.atlassian.net/browse/HHH-17415" )
167+
public void testInSubqueryGroupByImplicitJoin(SessionFactoryScope scope) {
168+
scope.inTransaction( session -> assertThat( session.createQuery(
169+
"select a from EntityA a where a.secondary in" +
170+
" (select a2.secondary from EntityA a2 group by a2.secondary)",
171+
Tuple.class
172+
).getResultList() ).hasSize( 2 ) );
173+
}
174+
156175
@Entity( name = "EntityA" )
157176
public static class EntityA {
158177
@Id

0 commit comments

Comments
 (0)