title: Self-Reference One-to-One mapping in Hibernate
body: <p>I have a class A which has a property type indicating whether it is a receipt or a delivery. A receipt can be mapped to a single delivery and vice-versa. Now consider that the receipt transaction and the delivery transaction are siblings.<br>
  So class A has a <em>sibling</em> of type A. "A" and its sibling have a <em>one-to-one</em> relationship as established above.</p>
  
  <pre><code>Class A {  
      private A sibling;  
  }
  
  &lt;hibernate-mapping&gt;  
      &lt;class name="A" table="A"&gt;  
          &lt;id name="Id" type="java.lang.Integer" column="id"&gt;  
              &lt;generator class="native"&gt;&lt;/generator&gt;  
          &lt;/id&gt;  
          &lt;one-to-one  name="sibling" class="A" lazy="proxy" /&gt;  
      &lt;/class&gt;  
  &lt;/hibernate-mapping&gt;  
  </code></pre>
  
  <p>I am unable to figure out a way to create a self-referencing one-to-one mapping.</p>