title: Error executing MySQL query via ebean using RawSql
body: <p>In a Play! 2.x application, I'm trying to send a simple query to a MySQL server using ebean.  </p>
  
  <p>My complete class looks as follows:</p>
  
  <pre><code>public static List&lt;Venue&gt; search(String query) {
      List&lt;Venue&gt; matches = new ArrayList&lt;Venue&gt;();
      try {
          String q = query.replace(" ", "");
  
          String sql =    "SELECT  v.id, c.company, c.postcode \n" +
                          "FROM    venue v \n" +
                          "JOIN    contact c ON (c.id = v.id) \n" +
                          "WHERE   REPLACE(c.postcode, ' ', '') LIKE '%" + q + "%' \n" +
                          "    OR  c.company LIKE '%" + q + "%'";
  
          RawSql rawSql = RawSqlBuilder.unparsed(sql)
              .columnMapping("v.id", "id")
              .columnMapping("c.company", "contact.company")
              .columnMapping("c.postcode", "contact.postcode")
              .create();
  
          Query&lt;Venue&gt; eQ = Ebean.find(Venue.class);
  
          eQ.setRawSql(rawSql);
  
          matches = eQ.findList();
      }
      catch (Exception e) {
          Utils.eHandler("Venue.search(" + query + ")", e);
      }
      finally {
          return matches;
      }
  }
  </code></pre>
  
  <p>However, executing the line...</p>
  
  <pre><code>matches = eQ.findList();
  </code></pre>
  
  <p>..results in the following error, which appears to be a MySQL error(?):</p>
  
  <pre><code>Query threw SQLException:Column Index out of range, 0 &lt; 1.
  Bind values:[]
  Query was:
  SELECT  v.id, c.company, c.postcode
  FROM    venue v
  JOIN    contact c ON (c.id = v.id)
  WHERE   REPLACE(c.postcode, ' ', '') LIKE '%sw3%'
          OR  c.company LIKE '%sw3%'
  </code></pre>
  
  <p>The query itself is fine, for example I can copy the version from the error message, paste it into MySQL Workbench, and it executes no problem.</p>
  
  <p>Note that I'm using RawSql because I'll need to have more than 2 "OR" clauses, and as far as I know this is the only way to do it.</p>
  
  <p>Can anyone help? </p>
  
  <p>Thanks!</p>