Having a cast like this:
SELECT
CAST(a * 100000000 as big_integer)
FROM
Amount
WHERE
id = :id
Generate this SQL:
prepareStatement(
"select cast(amount0_.\"a\"*100000000 as numeric(19, 2)) from \"AMOUNT\" where amount0_.\"id\"=?");
Question: Why two decimal places though?
There are some other problems
- cast as Long in HQL - int8 in SQL (but long is bigger than int8)
- cast as Double in HQL - float8 in SQL (but double is more precise than float8)
Using:
- Hibernate-core-jakarta 5.6.15.Final
- Postgres jdbc 42.7.4
CAST()is up to the JDBC driver. Why do you need to do this explicit cast?