• 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

NamedParameterJdbcTemplate and Function Call

 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic