1

I'm running the following as part of the where clause of an HQL query:

:timeToTopOfList = ((CAST((j.displayed_position - 1) AS FLOAT) / jp.openings_per_month) * 30)

When I run it in SQL Management studio it works just fine, but when I run it through eclipse I get the following error:

Caused by: java.lang.NullPointerException org.hibernate.dialect.function.CastFunction.render(CastFunction.java:55)

I'm also using JPA, and according to this answer you cannot convert types if you're using JPA. Is that true?

I really need to divide two int value columns as a float.

Community
  • 1
  • 1
Hanna
  • 10,315
  • 11
  • 56
  • 89

1 Answers1

1

I faced a similar issue when casting to string.

It was resolved by typing in 'string' in lower case.

Try with lower case 'float'

Check out the below link for an explanation:

https://forum.hibernate.org/viewtopic.php?t=960362

Prafful Nagpal
  • 339
  • 3
  • 9