I need to compare for equality on a number stored in the database as a floating point number (this has to support multiple databases and I haven't got any control over how it's stored), but of course equality will only get you so far with an approximated value, so I need to round the column value like this:
select * from x where round(col, 2) = ?;
Unfortunately I can't seem to find a way of doing that in JPQL. Is there any way to achieve this (without changing the database)?
I have two ideas to solve this problem:
make a between query
use a native query
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.