-
1. Re: RESTRICTIONS in EJBQL
chawax Mar 31, 2009 3:27 PM (in response to jsosa)I have the same kind of problem, with some queries that use float parameters. The equal operator in where clauses doesn't work. I thought about wrong Java / SQL type mappings, but could not find a way to solve this. If I remember well (I had the problem a long time ago), I could make it work with some databases (either SQL Server either Oracle, I don't remember), but it doesn't work with HSQLDB for example (the one I use for my unit tests).
-
2. Re: RESTRICTIONS in EJBQL
ztiringer Apr 1, 2009 1:29 AM (in response to jsosa)Indeed, it must be a DB specific issue (probably in Hibernate), because restrictions for BigDecimal work just fine for me with the same syntax that you are using, while connecting to Oracle. What DB are you using? Probably you should check out some Hibernate forums, too...
-
3. Re: RESTRICTIONS in EJBQL
swd847 Apr 1, 2009 1:38 AM (in response to jsosa)Is the underlying database type a double or an arbitrary precision number of some kind?
At any rate why do you need BigDecimal equality in your queries? Are you sure that these fields should not be integers?
If you really do need this equality then the way you approach it is to define a small constant Epsilon and write your query like this:
"abs(persona.datosServicio.colectivo.codigo - #{personaList.persona.datosServicio.colectivo.codigo}) < my_epsilon_constant"
What value to use for epsilon depends on the application and the underlying type.
-
4. Re: RESTRICTIONS in EJBQL
ztiringer Apr 1, 2009 1:48 AM (in response to jsosa)Checking again your code, it seems necessary to add to EJBQL the join to datosServicio and colectivo, otherwise you can hardly restrict them (as they seem to be separate entities)