Reputation: 5674
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)?
Upvotes: 0
Views: 4045
Reputation: 16060
I have two ideas to solve this problem:
make a between query
use a native query
Upvotes: 4