Calling the following oracle function with Hibernate 6.1.7 returns an BigInteger of value 1.23:
create or replace Function "HIBERNATE_TEST"
RETURN NUMBER is
d_RET DECIMAL(5,2);
BEGIN
d_RET := 1.23;
return d_RET;
END;
The function is called as follows:
public BigDecimal hibernateTest() {
Object result = entityManager
.createNativeQuery(
"SELECT HIBERNATE_TEST() FROM DUAL")
.getSingleResult();
return (BigDecimal) result; }
Calling the same function with the same code as above returns an Integer of value 1 which causes an ClassCastException. |