When to use property-ref attribute in hibernate
<p>I have done the sample program. I used property-ref attribute. Even if I do not use also it is still working. Please let me know what is the actual usage of property-ref attribute in this program.</p>

<pre><code> &lt;hibernate-mapping package="com.hibernate.onetone"&gt;
 &lt;class name="Book" table="BOOK"&gt;
    &lt;id name="id" column="BOOK_ID"&gt;
        &lt;generator class="native" /&gt;
    &lt;/id&gt;
    &lt;property name="title" type="string" column="TITLE" /&gt;
    &lt;property name="description" type="string" column="DESCRIPTION" /&gt;
    &lt;property name="publishedDate" type="date" column="PUBLISHED" /&gt;

    &lt;many-to-one name="author" class="com.hibernate.onetone.Author"
        column="author_id" unique="true" not-null="true"
        cascade="all" /&gt;             
   &lt;/class&gt;
  &lt;/hibernate-mapping&gt;

  &lt;hibernate-mapping package="com.hibernate.onetone"&gt;
  &lt;class name="Author" table="AUTHOR"&gt;
    &lt;id name="id" column="AUTHOR_ID"&gt;
        &lt;generator class="native"/&gt;
    &lt;/id&gt;
    &lt;property name="name" column="NAME" /&gt;
    &lt;property name="email" column="EMAIL" /&gt;  

   &lt;!--  &lt;property name="serialNumber" column="SerialNumber" /&gt; --&gt;
    &lt;one-to-one name="book" class="Book" property-ref="author"
   constrained="true" cascade="all"/&gt;    
   &lt;/class&gt; 
  &lt;/hibernate-mapping&gt;

   public class Book {
   private long id;
   private String title;
   private String description;
   private Date publishedDate;
   private Author author;       
   }
  public class Author {
  private long id;
  private String name;
  private String email;
  private Book book;     {
  }
</code></pre>