title: Oracle : Autopopulate foreign key if parent table referenced column has values
body: <p>This could be dumb question but somehow I am not able to get around it. </p>
  
  <p>I have the tables <code>status</code> and <code>logs</code>, both tables have <code>jobId</code> column. <code>jobId</code> is generated based on sequence and so I want to add <code>sequence generated jobId</code> from <code>logs</code> table to <code>status</code> page. </p>
  
  <p>I have created foreign key in <code>status</code> table referencing to <code>jobId</code> column to <code>logs</code> table but jobId values are not populated in <code>status</code> table.</p>
  
  <p>How can I autopopulate <code>jobId</code> in <code>status</code> table when <code>jobId</code> is auto-generated in <code>logs</code> using sequence?</p>
  
  <p><strong>Update</strong></p>
  
  <pre><code>&lt;id name="jobid"
          column="JOBID"
          type="long"
          unsaved-value="-1"&gt;
        &lt;generator class="native"&gt;
              &lt;param name="sequence"&gt;ID_SEQ&lt;/param&gt;
          &lt;/generator&gt;
      &lt;/id&gt;
  </code></pre>
  
  <p>Here is how am generating id for <code>status</code> page, as suggested i need to use ID_SEQ.curval but how can i do that in hibernate, any idea?</p>
  
  <p>something like </p>
  
  <pre><code>&lt;id name="id"
          column="ID"
          type="long"
          unsaved-value="-1"&gt;
        &lt;generator class="native"&gt;
              &lt;param name="sequence"&gt;ID_SEQ.curval&lt;/param&gt;
          &lt;/generator&gt;
      &lt;/id&gt;
  </code></pre>
  
  <p>Thoughts?</p>