title: Why is it recommended to avoid unidirectional one-to-many association on a foreign key?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1307203/hibernate-unidirectional-one-to-many-association-why-is-a-join-table-better">Hibernate unidirectional one to many association - why is a join table better?</a>  </p>
  </blockquote>
  
  
  
  <p>In the Hibernate online documentation, under section 7.2.3 One-to-many, it's mentioned, that:</p>
  
  <blockquote>
    <p>unidirectional one-to-many association
    on a foreign key is an unusual case,
    and is not recommended. You should
    instead use a join table for this kind
    of association.</p>
  </blockquote>
  
  <p>I would like to know why? The only thing that comes to my mind is, it can create problems during cascade deletes. For example, Person refers to address on a one to many relationship on a foreign key, and the address would refuse to be deleted before the person.</p>
  
  <p>Can anyone explain the rational behind the recommendation?</p>
  
  <p>Here is the link to the reference document content: <a href="http://docs.jboss.org/hibernate/stable/core/reference/en/html/associations.html#assoc-unidirectional-12m" rel="nofollow noreferrer">7.2.3. One-to-many</a></p>
  
  <p>I have copy pasted the actual content here:</p>
  
  <blockquote>
    <p>A unidirectional one-to-many association on a foreign key is an
    unusual case, and is not recommended.</p>
  
  <pre><code>&lt;class name="Person"&gt;
      &lt;id name="id" column="personId"&gt;
          &lt;generator class="native"/&gt;
      &lt;/id&gt;
      &lt;set name="addresses"&gt;
          &lt;key column="personId" 
              not-null="true"/&gt;
          &lt;one-to-many class="Address"/&gt;
      &lt;/set&gt;
  &lt;/class&gt;
  
  &lt;class name="Address"&gt;
      &lt;id name="id" column="addressId"&gt;
          &lt;generator class="native"/&gt;
      &lt;/id&gt;
  &lt;/class&gt;
  </code></pre>
    
    <hr>
  
  <pre><code>create table Person (personId bigint not null primary key)
  create table Address (addressId bigint not null primary key, personId bigint not null)
  </code></pre>
    
    <p>You should instead use a join table for this kind of association.</p>
  </blockquote>