From 98b014c7896cf8dec6466549a350c684f2223cb2 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Thu, 2 May 2024 18:38:16 +0200 Subject: [PATCH] assertions for extract(offset hour/minute) Signed-off-by: Gavin King --- .../orm/test/query/hql/FunctionTests.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 9eb1a0c968..b960b7ca6d 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 @@ -1932,6 +1932,21 @@ public class FunctionTests { ); } + @Test + @RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTimezoneTypes.class) + public void testExtractOffsetHourMinute(SessionFactoryScope scope) { + scope.inTransaction( + session -> { + assertEquals(3, + session.createQuery("select extract(offset hour from offset datetime 2024-2-5 12:30:12+03:12)", Integer.class) + .getSingleResult()); + assertEquals(12, + session.createQuery("select extract(offset minute from offset datetime 2024-2-5 12:30:12+03:12)", Integer.class) + .getSingleResult()); + } + ); + } + @Test @RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTimezoneTypes.class) @RequiresDialectFeature(feature = DialectFeatureChecks.SupportsFormat.class, comment = "We extract the offset with a format function")