diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java index 1a4297e7f6..0e8345589d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java @@ -1881,4 +1881,36 @@ public class FunctionTests { ); } + @Test + public void testMaxGreatest(SessionFactoryScope scope) { + scope.inTransaction( + session -> { + assertEquals(10L, session.createQuery("select greatest((select max(someLong) from SimpleEntity), (select max(someInteger) from SimpleEntity))", Long.class) + .getSingleResult()); + } + ); + } + + @Test + @SkipForDialect(dialectClass = OracleDialect.class) + @SkipForDialect(dialectClass = MariaDBDialect.class) + public void testMaxOverUnion(SessionFactoryScope scope) { + scope.inTransaction( + session -> { + assertEquals(10L, session.createQuery("select max(val) from (select someLong as val from SimpleEntity union select someInteger as val from SimpleEntity)", Long.class) + .getSingleResult()); + } + ); + } + + @Test + @SkipForDialect(dialectClass = DerbyDialect.class) + public void testBetweenDates(SessionFactoryScope scope) { + scope.inTransaction( + session -> { + session.createSelectionQuery("select theDate from EntityOfBasics where theDate between local date and local date + 7 day").getResultList(); + } + ); + } + }