title: Postgres Parameter Query for SimpleJdbcTemplate
body: <p>I am trying to execute a parameter query for a Postgre database using Springs SimpleJdbcTemplate.  My class that calls the query looks like this:</p>
  
  <pre><code>public class GeoCodeServiceImpl extends SimpleJdbcDaoSupport implements GeoCodeServiceInterface {
  
  public static final String SELECT_STATEMENT = "SELECT ste_code, ste_code_type, name, fips_code " +
                                                "FROM \"steGeo\" " +
                                                "WHERE st_contains( the_geom, ST_GeomFromText('POINT(:lon :lat)',4269))";
  
  public List&lt;GeoCode&gt; getGeoResults(Double lon, Double lat) throws DataAccessException {
  
      MapSqlParameterSource mappedParms = new MapSqlParameterSource("lon", lon.toString());
      mappedParms.addValue("lat", lat.toString());
      SqlParameterSource namedParms = mappedParms;
  
      List&lt;GeoCode&gt; resultList = getSimpleJdbcTemplate().query(SELECT_STATEMENT, new GeoCodeRowMapper(), namedParms);
  
      if (resultList == null || resultList.size() == 0) {
          logger.warn("No record found in GeoCode lookup.");
      }
  
      return resultList;
  
  }
  
  protected static final class GeoCodeRowMapper implements RowMapper&lt;GeoCode&gt; {
      public GeoCode mapRow(ResultSet rs, int i) throws SQLException {
          GeoCode gc = new GeoCode();
              gc.setCode(rs.getString(1));
              gc.setType(rs.getString(2));
              gc.setFips(rs.getString(3));
              gc.setName(rs.getString(4));
          return gc;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am testing the query with this class:</p>
  
  <pre><code>public class GeoCodeServiceTest {
  
  public static void main(String[] args) {
  
      Double lat = 40.77599;
      Double lon = -83.82322;
  
      String[] cntxs = {"project-datasource-test.xml","locationService-context.xml"};
      ApplicationContext ctx = new ClassPathXmlApplicationContext(cntxs);
      GeoCodeServiceImpl impl = ctx.getBean("geoCodeService", GeoCodeServiceImpl.class);
      List&lt;GeoCode&gt; geoCodes = impl.getGeoResults(lon, lat);
      System.out.println(geoCodes);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I keep getting the following error:</p>
  
  <pre><code>    2011-03-07 08:16:29,227 [main] DEBUG org.springframework.jdbc.support.SQLErrorCodesFactory - SQL error codes for 'PostgreSQL' found
  2011-03-07 08:16:29,227 [main] DEBUG org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator - Unable to translate SQLException with SQL state 'XX000', error code '0, will now try the fallback translator
  2011-03-07 08:16:29,227 [main] DEBUG org.springframework.jdbc.support.SQLStateSQLExceptionTranslator - Extracted SQL state class 'XX' from value 'XX000'
  Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT ste_code, ste_code_type, name, fips_code FROM "steGeo" WHERE st_contains( the_geom, ST_GeomFromText('POINT(:lon :lat)',4269))]; SQL state [XX000]; error code [0]; ERROR: parse error - invalid geometry
    Hint: "POINT(" &lt;-- parse error at position 6 within geometry; nested exception is org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry
    Hint: "POINT(" &lt;-- parse error at position 6 within geometry
  </code></pre>
  
  <p>It looks like my parameters are not populated.
  I haven't used Postgre before so any help would be much appreciated.</p>
  
  <p>Thanks</p>