title: Simple 1-N FK relationship woes
body: <p>I'm trying to get a simple 1-N FK relationship working with DataNucleus JDO. I have classes GridDO and GridColumnDO with relevant getters and setters. I'm trying to establish that a grid has multiple columns. The entity_attribute (GridColumn) table has a FK column (named entity_id) to the entity (Grid) table's PK (also named entity_id). I worked off of <a href="http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_many_collection.html#fk_uni" rel="nofollow">the example code</a> on the DataNucleus website. I can load the GridDO object, but when I try to get the columns, I get </p>
  
  <pre><code>Iteration request failed : SELECT 'com.mycompany.myapplication.data.GridColumnDO' AS NUCLEUS_TYPE,A0.DISPLAY_NAME,A0.COLUMN_ORDER,A0.PROPERTY_NAME,A0.ENTITY_ID,A0.ENTITY_ATTRIBUTE_ID,A0.VALUE_TYPE FROM ENTITY_ATTRIBUTE A0 WHERE A0.ENTITY_ID = ?
  org.datanucleus.exceptions.NucleusDataStoreException: Iteration request failed : SELECT 'com.mycompany.myapplication.data.GridColumnDO' AS NUCLEUS_TYPE,A0.DISPLAY_NAME,A0.COLUMN_ORDER,A0.PROPERTY_NAME,A0.ENTITY_ID,A0.ENTITY_ATTRIBUTE_ID,A0.VALUE_TYPE FROM ENTITY_ATTRIBUTE A0 WHERE A0.ENTITY_ID = ?
  ...
  Caused by: java.sql.SQLException: Parameter #1 has not been set.
  </code></pre>
  
  <p>Does anybody know what I might be doing wrong? I've been searching and banging at this for a while now, with no real luck. This is an excerpt from package-mssql.orm:</p>
  
  <pre><code>    &lt;class name="GridDO" identity-type="application" table="entity"&gt;
          &lt;field name="id" primary-key="true"&gt;
              &lt;column name="entity_id"/&gt;
          &lt;/field&gt;
          &lt;field name="columns"&gt;
              &lt;collection element-type="com.mycompany.myapplication.data.GridColumnDO"/&gt;
              &lt;element column="entity_id"/&gt;
          &lt;/field&gt;
          ...
      &lt;/class&gt;
  
      &lt;class name="GridColumnDO" identity-type="application" table="entity_attribute"&gt;
          &lt;field name="id" primary-key="true"&gt;
              &lt;column name="entity_attribute_id"/&gt;
          &lt;/field&gt;
          ...
      &lt;/class&gt;
  </code></pre>