title: How to use cascade type save,delete, update in hibernate annotation
body: <p>Can any one explain me the hibernate annotation how to use different types of cascade like delete,upadte,save-update? </p>
  
  <p>How can I make sure that when an Owner is deleted, its car is deleted as well (but not the other way around)</p>
  
  <pre><code> @Entity
      public class Owner
      {
          @OneToOne(cascade=CascadeType.ALL)
          private DrivingLicense license;
  
          @OneToMany(mappedBy="owner", cascade={CascadeType.PERSIST, CascadeType.MERGE})
          private Collection cars;
  
          ...
      }
  
      @Entity
      public class DrivingLicense
      {
          private String serialNumber;
  
          ...
      }
  
      @Entity
      public class Car
      {
          private String registrationNumber;
  
          @ManyToOne(cascade={CascadeType.PERSIST, CascadeType.MERGE})
          private Owner owner;
  
          ...
      }
  </code></pre>