title: Insert into table1 (select columns from table2) using ibatis, not recognizing parameter value
body: <p>I am using an insert into select mysql query, but in the select statement I am passing a parameter(map) from Java. This query is written using iBatis framework. The query is not recognizing the passed value in the select statement.</p>
  
  <p>I have tried changing <code>#id#</code> to 
   <code>#{id}</code>, <code>$id$</code>, <code>#{id}</code> and <code>${id}</code> but didn't succeed.</p>
  
  <p>The query goes like this:</p>
  
  <pre><code>    &lt;insert id="someId" parameterClass="map" &gt;
      insert into table1(id, column1, column2)
      (
        select #id#, A.column1, A.column2
              from table2 A left outer join table3 B on A.column = B.column
                   where &lt;condition&gt;
                        order by column1, column2
      )
      &lt;/insert&gt;
  </code></pre>
  
  <p>I have sent the request parameter as a 13-digit long id.
  In the table1 schema, id has bigint(20) as its datatype.</p>
  
  <p>I want whatever parameter(id) I am passing to the query to be inserted in the table.</p>
  
  <p>Now the problem is that it is not recognizing the value of <code>#id#</code>.
  As the id column constraint is not null, it is throwing <code>"MySQLIntegrityConstraintViolationException: Column 'id' cannot be null" after running the above statement.</code></p>
  
  <p>What should I try instead of #id# to get it working? Or could it be some other problem?</p>