HHH-18272 Add test for issue

This commit is contained in:
Marco Belladelli 2024-06-28 11:17:35 +02:00 committed by Christian Beikov
parent 0047b070d6
commit 5e4c35441c
1 changed files with 18 additions and 0 deletions

View File

@ -119,6 +119,15 @@ public class EntityValuedPathsGroupByOrderByTest {
).getSingleResult().get( 1 ) ).isEqualTo( 3L ) ); ).getSingleResult().get( 1 ) ).isEqualTo( 3L ) );
} }
@Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-18272" )
public void testJoinSelectAliasAndGroupByAndOrderBy(SessionFactoryScope scope) {
scope.inTransaction( session -> assertThat( session.createQuery(
"select b as secondary, sum(a.amount) from EntityA a join a.secondary b where b.id = 1 group by secondary order by secondary",
Tuple.class
).getSingleResult().get( 1 ) ).isEqualTo( 3L ) );
}
// Implicit join ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Implicit join ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Test @Test
@ -153,6 +162,15 @@ public class EntityValuedPathsGroupByOrderByTest {
).getSingleResult().get( 1 ) ).isEqualTo( 3L ) ); ).getSingleResult().get( 1 ) ).isEqualTo( 3L ) );
} }
@Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-18272" )
public void testImplicitJoinSelectAliasAndGroupByAndOrderBy(SessionFactoryScope scope) {
scope.inTransaction( session -> assertThat( session.createQuery(
"select a.secondary as a_secondary, sum(a.amount) from EntityA a where a.secondary.id = 1 group by a_secondary order by a_secondary",
Tuple.class
).getSingleResult().get( 1 ) ).isEqualTo( 3L ) );
}
@Test @Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-17415" ) @Jira( "https://hibernate.atlassian.net/browse/HHH-17415" )
public void testInSubqueryGroupBy(SessionFactoryScope scope) { public void testInSubqueryGroupBy(SessionFactoryScope scope) {