title: Java Mybatis sql inserting data in a table with composite key where both key parameter as foreign keys
body: <p>I'm trying to make a User-Bundle relation, where the relation between them is many-many.</p>
  <p>So, to break this many to many into 2 one-to-many, I've created another table called subscription.</p>
  <p>The subscription table has primary keys of both user and bundle as foreign keys. The Subscription table has a composite key made of (userId,bundleId), where both these columns are not null in their respective table.</p>
  <p>Now, when I try to insert data in the subscription table using mybatis, it gives error userId cannot be null.</p>
  <p>The reason being, mybatis sql is converted to a prepared statement which is used for dynamic parameters.
  Here's an insert statement to give you a rough idea about my subscription table</p>
  <pre><code>INSERT INTO Subscription (USERID,BUNDLEID,BUNDLESTARTDATE)
         VALUES (#{userId},#{bundleId},#{promotionStartDate});
  </code></pre>
  <p>Although I'm passing the userId, it doesn't accept it and calls userId cannot be null. I'm fairly sure this is due to the prepared statement. Please help.</p>