title: How do I configure solr's data-config.xml to query a foreign key?
body: <p>I am following the document on data import from <a href="http://wiki.apache.org/solr/DataImportHandler" rel="nofollow">solr</a>.  I can connect to my local database but the configuration file is having trouble reading a foreign key.  My tables are:</p>
  
  <pre><code>product
  ------------
  id
  name
  continent_id
  
  
  continent
  ------------
  id
  name
  </code></pre>
  
  <p>My <code>data-config.xml</code> is:</p>
  
  <pre><code>&lt;dataConfig&gt;
    &lt;dataSource type="JdbcDataSource" driver="org.postgresql.Driver" url="jdbc:postgresql://localhost/my_db" user="postgres" password="postgres" readOnly="true" /&gt;
    &lt;document name="products"&gt;
      &lt;entity name="product" query="select * from product"&gt;
        &lt;field column="ID" name="id" /&gt;
        &lt;field column="NAME" name="name" /&gt;
  
        &lt;entity name="continent" query="select NAME from continent where id='${product.CONTINENT_ID}'"&gt;
          &lt;field column="name" name="continent" /&gt;
        &lt;/entity&gt;            
      &lt;/entity&gt;
    &lt;/document&gt;
  &lt;/dataConfig&gt;
  </code></pre>
  
  <p>The error I am seeing is:</p>
  
  <pre><code>SEVERE: Exception while processing: product document : SolrInputDocument[{id=id(1.0)={1}, name=name(1.0)={Fancy Pants}}]:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select NAME from continent where id='' Processing Document # 1
  </code></pre>
  
  <p>It's connecting to the database fine but cannot read the foreign key <code>product.CONTINENT_ID</code>.  Do I need to configure the xml above differently to read and index the <code>continent</code> foreign key?</p>