• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with ROUND function on H2 database

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone come across the following problem in JPA/Hibernate/Spring:

I have a persisted instance of a class MyClass which contains a Float instance variable, f, mapped to a database FLOAT type (either Oracle or H2). The value of f is 123.456.

I execute the following code:


Which prints "1" when run with an Oracle database (which is what I would expect), but "0" with H2.

What's more, on H2, when I remove the ROUND function and just query on "myClass.f = ?1" I get one result as expected, which suggests ROUND is the problem. But also when I leave ROUND there, and hardcode the parameter ?1 as "123.456" I also get one result, which suggests it's the setting of the parameter that's the problem!!!

Can anyone enlighten me as to what's going wrong here?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic