File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,35 @@ public void testInSubqueryGroupByImplicitJoin(SessionFactoryScope scope) {
188188 ).getResultList () ).hasSize ( 2 ) );
189189 }
190190
191+ @ Test
192+ @ Jira ( "https://hibernate.atlassian.net/browse/HHH-18862" )
193+ public void testSubquerySelectionGroupBy (SessionFactoryScope scope ) {
194+ scope .inTransaction ( session -> assertThat ( session .createQuery (
195+ "select (select s.id from EntityB ignore) from EntityA a join a.secondary s group by s.id" ,
196+ Long .class
197+ ).getSingleResult () ).isEqualTo ( 1L ) );
198+ }
199+
200+ @ Test
201+ @ Jira ( "https://hibernate.atlassian.net/browse/HHH-18862" )
202+ public void testSubquerySelectionGroupByAndOrderBy (SessionFactoryScope scope ) {
203+ scope .inTransaction ( session -> assertThat ( session .createQuery (
204+ "select (select s.id from EntityB ignore) from EntityA a"
205+ + " join a.secondary s group by s.id order by s.id" ,
206+ Long .class
207+ ).getSingleResult () ).isEqualTo ( 1L ) );
208+ }
209+
210+ @ Test
211+ @ Jira ( "https://hibernate.atlassian.net/browse/HHH-18862" )
212+ public void testSubquerySelectionGroupByAndOrderByImplicit (SessionFactoryScope scope ) {
213+ scope .inTransaction ( session -> assertThat ( session .createQuery (
214+ "select (select a.secondary.id from EntityB ignore) from EntityA a"
215+ + " group by a.secondary.id order by a.secondary.id" ,
216+ Long .class
217+ ).getSingleResult () ).isEqualTo ( 1L ) );
218+ }
219+
191220 @ Entity ( name = "EntityA" )
192221 public static class EntityA {
193222 @ Id
You can’t perform that action at this time.
0 commit comments