title: Prepared statement parameter not being set in DataNucleus
body: <p>I'm trying to insert an Employee object into the database using DataNucleus 2.1.1, but the foreign-key Position parameter is not being set before the "insert" prepared statement is executed.  What am I doing that prevents the parameter from being set?  Am I leaving something out?  Reading works fine.</p>
  
  <pre><code>DEBUG [DataNucleus.Datastore.Native] - INSERT INTO MYSCHEMA.EMPLOYEE ("NAME",POSITION_ID,ID) VALUES (&lt;'John Doe'&gt;,&lt;UNPRINTABLE&gt;,&lt;100&gt;)
  WARN  [DataNucleus.Datastore.Persist] - Insert of object "com.example.staff.Employee@50 7895d8" using statement "INSERT INTO MYSCHEMA.EMPLOYEE ("NAME",POSITION_ID,ID) VALUES (?,?,?)" failed : Invalid operation: parameter 2 not set or registered
  
  PersistenceManager pm = // obtain PersistenceManager
  Position position = // obtain Position using pm (I can post this code upon request)
  Employee employee =new Employee(100, "John Doe", position);
  pm.makePersistent(employee);
  pm.close();
  
  
  &lt;jdo&gt;
  &lt;package name="com.example.staff"&gt;
      &lt;class name="Position" identity-type="application" schema="MYSCHEMA" table="Position"&gt;
          &lt;inheritance strategy="new-table"/&gt;
          &lt;field name="id" primary-key="true" persistence-modifier="persistent" default-fetch-group="true"&gt;
              &lt;column name="ID" jdbc-type="integer"/&gt;
          &lt;/field&gt;
          &lt;field name="title" persistence-modifier="persistent" default-fetch-group="true"&gt;
              &lt;column name="TITLE" jdbc-type="varchar"/&gt;
          &lt;/field&gt;
      &lt;/class&gt;
  &lt;/package&gt;
  &lt;/jdo&gt;
  
  &lt;jdo&gt;
  &lt;package name="com.example.staff"&gt;
      &lt;class name="Employee" identity-type="application" schema="MYSCHEMA" table="EMPLOYEE"&gt;
          &lt;inheritance strategy="new-table"/&gt;
          &lt;field name="id" primary-key="true" persistence-modifier="persistent" default-fetch-group="true"&gt;
              &lt;column name="ID" jdbc-type="integer"/&gt;
          &lt;/field&gt;
          &lt;field name="name" persistence-modifier="persistent" default-fetch-group="true"&gt;
              &lt;column name="NAME" jdbc-type="varchar"/&gt;
          &lt;/field&gt;
          &lt;field name="position" persistence-modifier="persistent" default-fetch-group="true"&gt;
              &lt;column name="POSITION_ID" jdbc-type="integer" /&gt;
          &lt;/field&gt;
      &lt;/class&gt;
  &lt;/package&gt;
  &lt;/jdo&gt;
  
  @PersistenceCapable
  public class Employee extends Object {
     private Integer id;
     private String name;
     private Position position;
  
     public Employee(Integer id, String name, Position position) {
        this.id =id;
        this.name =name;
        this.position =position;
        }
  }
  
  @PersistenceCapable
  public class Position extends Object {
     private Integer id;
     private String title;
  }
  </code></pre>