title: Parameterizing postgis geometry query
body: <p>I'm trying to query whether any of a set of polygons (passed in at runtime) intersects with a set of polygons stored in the database in the &quot;enclosing_polygons&quot; field, which is a MultiPolygonField.</p>
  <p>Here is an example of the query:</p>
  <pre><code>select * from my_table where field1 = any (?) and field2 = any (?) and (
  ST_Intersects(ST_GeometryFromText('POLYGON((? ?, ? ?, ? ?, ? ?, ? ?))'), enclosing_polygons) or
  ST_Intersects(ST_GeometryFromText('POLYGON((? ?, ? ?, ? ?, ? ?, ? ?))'), enclosing_polygons)) 
  and detection_type = 0 order by confidence desc limit 2000
  </code></pre>
  <p>The query works fine with hardcoded values, but when I try to parameterize it, Postgres does not seem to recognize the ? placehoders for the polygon points as parameters when I try to populate them.</p>
  <p>When I set the first two parameters (for field1 and field2), these JDBC statements succeed:</p>
  <pre><code>statement.setArray(1, array1)
  statement.setArray(2, array2)
  </code></pre>
  <p>However, if I try to set any parameters beyond these first two, they fail.  This statement:</p>
  <p>statement.setDouble(3, point1x)</p>
  <p>fails with the following error:</p>
  <pre><code>The column index is out of range: 3, number of columns: 2.
  </code></pre>
  <p>Why does Postgres not recognize these ?s in the POLYGON constructor as query parameters?</p>
  <p>How can I make this work?</p>