Skip to content

Commit

Permalink
add test for cast() with parameters in numeric expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Jul 25, 2023
1 parent b53732d commit d3a1b4f
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d3a1b4f

Please sign in to comment.