mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-28 06:49:09 +00:00
add test for cast() with parameters in numeric expressions
This commit is contained in:
parent
b53732d141
commit
d3a1b4f33e
@ -1354,6 +1354,26 @@ public void testIntervalScaleExpressions(SessionFactoryScope scope) {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddDurationWithParameter(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
session.createQuery("select 2 * cast(?1 as BigDecimal)")
|
||||
.setParameter(1, BigDecimal.valueOf(123.446))
|
||||
.getSingleResult();
|
||||
session.createQuery("select 2 * cast(?1 as BigDecimal(7,4))")
|
||||
.setParameter(1, BigDecimal.valueOf(123.446))
|
||||
.getSingleResult();
|
||||
session.createQuery("select cast(2 as BigDecimal) * ?1")
|
||||
.setParameter(1, BigDecimal.valueOf(123.446))
|
||||
.getSingleResult();
|
||||
session.createQuery("select cast(:dt as LocalDateTime) + 1 day")
|
||||
.setParameter("dt", LocalDateTime.now())
|
||||
.getSingleResult();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstantCast(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
|
Loading…
x
Reference in New Issue
Block a user