test for adding duration to a LocalTime

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-05-03 13:30:05 +02:00
parent 37018d2570
commit 14216fc267
1 changed files with 11 additions and 3 deletions

View File

@ -1760,10 +1760,18 @@ public class FunctionTests {
assertEquals( 10L*60,
session.createQuery("select (datetime 1974-03-23 5:30:25 - datetime 1974-03-23 5:20:25) by second", Long.class)
.getSingleResult() );
}
);
}
@Test
public void testTimeDurationArithmeticWithLiterals(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
// timestampadd() might not work for time on at least some dbs:
// assertEquals( LocalTime.of(5,30,25),
// session.createQuery("select time 5:30:46 - 21 second")
// .getSingleResult() );
assertEquals( LocalTime.of(5,30,25),
session.createQuery("select time 5:30:46 - 21 second")
.getSingleResult() );
}
);
}