i am using postgis with spring boot hibernate jpa.
Code in Repository:
@Query(value = "select {h-schema}ref_plz_geom.plz from {h-schema}ref_plz_geom WHERE ST_Contains(geom, ST_Transform(ST_GeomFromText('POINT(:userLongitude :userLatitude)',4647),4326))", nativeQuery=true)
String getPlz(Double userLongitude, Double userLatitude);
i get the following error :
2023-01-10 14:44:08,479 ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ERROR: parse error - invalid geometry
Hint: "POINT(:u" <-- parse error at position 8 within geometry
When i run the same query in postgres i get the pincode:
select
pincode
from
pin_code_table
WHERE
ST_Contains(geom, ST_Transform(ST_GeomFromText('POINT(32528808.761501245 5471624.355)',4647),4326))
But when i run the sring boot application , i get the above error.Please advice.
You need to declare the parameter name: