Thanks for the post. I would like to seek yr advice, for I tried to call the functions in Postgresql
using JPA/Hibernate
, I kept getting the error message. Could you please help? Thanks.
Following is the code:
String sql = “from Motot u where FUNCTION(‘earth_box’, FUNCTION(‘ll_to_earth’, :lat, :lon), :range) > FUNCTION(‘ll_to_earth’, u.g_Latitude, u.g_Longitude)”;
List resMeter2 = entityManager.createQuery(sqlMeter2, Motor.class)
.setParameter(“lat”, lat)
.setParameter(“lon”, lon)
.setParameter(“range”, radius)
.getResultList();
Here is the error messages:
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.postgresql.util.PSQLException: ERROR: function function(unknown, double precision, double precision) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Position: 930
Thanks alot