title: using hibernate to delete publisher with no books
body: <p>while writing a bookstore application ,I needed to put mappings for Book and Publisher classes.</p>
  
  <p>Book has n-to-1 relationship with Publisher.Also n-to-1 with Author .
  I wanted to give the admin user an option to delete books,authors or publishers.</p>
  
  <p>A Publisher with no Books makes no sense.Similar is the case for Author.If all books of a publisher are deleted,the publisher must be removed from db.
  If all Books of an Author get deleted ,the Author should also be deleted.
  It sounds like a delete-orphan cascading.But many-to-one mapping does not support delete-orphan .</p>
  
  <p>Also ,if I delete a Publisher ,all his books should be removed.
  Similarly, deleting an Author should delete all his Books.</p>
  
  <p>Currently ,I have the Author,Publisher and Book classes defined as below,
  The Book has fields Author and  Publisher .But ,Author or Publisher ,has no reference to their Books.
  Do I have to redefine these classes?
  How should I map the relation between Book and Publisher?</p>
  
  <p>Any help appreciated</p>
  
  <pre><code>public class Book {
      private Long bookId;    
      private Author author;
      private Publisher publisher;
  ...
  }
  
  public class Publisher {
      private Long publisherId;   
      private String name;        
  }
  
  public class Author {
      private Long authorId;
      private String name;    
  }
  
  &lt;class name="Book" table="BOOKS"&gt;
      &lt;id name="bookId" column="BOOKID" type="long"&gt;
      &lt;generator class="native"/&gt;
      &lt;/id&gt;
      ...
      &lt;many-to-one name="publisher" class="Publisher"   column="PUBLISHERID" lazy="false" cascade="save-update"/&gt;
    ...
  </code></pre>