HHH-18272 Add test for issue

This commit is contained in:
Marco Belladelli 2024-06-28 11:17:35 +02:00
parent a844019ba0
commit 1a0b582823

View File

@ -119,6 +119,15 @@ public void testJoinSelectAndGroupByAndOrderBy(SessionFactoryScope scope) {
).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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Test
@ -153,6 +162,15 @@ public void testImplicitJoinSelectAndGroupByAndOrderBy(SessionFactoryScope scope
).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
@Jira( "https://hibernate.atlassian.net/browse/HHH-17415" )
public void testInSubqueryGroupBy(SessionFactoryScope scope) {