• Post Reply Bookmark Topic Watch Topic
  • New Topic

NamedParameterJdbcTemplate and Function Call  RSS feed

Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I am facing a little problem, which I think is owing to the underlying prepared statement of the jdbc template.

here is what i want to do.

The tricky part is the location, which is a longitude latitude pair which must be interpreted as a postgis geometry.

what the underlying implementation of params.addValue("location", bookingCreditTour.getLocation()) does is the following:

So the addValue method turns the LocationDV into a String ST_MakePoint(longitude, latitude).

Of course, the ST_MakePoint is a postgis function that needs to be evaluated on the db-server, and i think this is where the problem lies, as this does not go together with prepared statements (or at least i don't know how to).

I could turn the sql query into

but I would really like to encapsulate this away (especially as longitude and latitude tend to get mixed up).

In essence, the question is if there is a way to include this ST_MakePoint function call into the prepared statement.

Thanks for your help
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!