title: grails foreign key error in delete parent row
body: <p>I have the following situation:</p>
  
  <pre><code>class Receipt {
  
     BigDecimal totalAmount;
     Date releaseDate;
  
     @NotNull
     Integer vatPercentage;
  
     @NotNull
     Integer discount;
  
     Boolean isPayed;
     Boolean isInvoice;
     Boolean hasStampDuty;
  
     Integer documentNumber;
  
     @NotNull
     static belongsTo = [patient:Patient, doctor:Doctor]
  
     @NotNull
     static hasMany = [healthServices:Receipt_HealthService]
  
  
      static constraints = {
          healthServices(blank:  false)
          patient(blank: false)
          totalAmount(blank: false, )
          vatPercentage(blank: false, nullable: false)
  
      }
  
  
  }
  
  
  class HealthService {
  
     int vat;
     String description;
     BigDecimal price;
  
     static belongsTo = [healthServiceType:HealthServiceType, doctor:Doctor]
  
     static constraints = {
        healthServiceType(blank: false)
        vat(size: 11..11)
        description(maxSize: 255)
  
      }
  }  
  
  
  class Receipt_HealthService {
  
     Receipt receipt
     HealthService healthService
     int quantity = 1
  
     static constraints = {
     }
  }
  </code></pre>
  
  <p>I've manually created the Receipt_HealthService domain class, as described in the post <a href="https://stackoverflow.com/questions/30954545/grails-one-to-many-with-additional-column">here</a>.
  Everything works well, but when I try to delete a Receipt instance, I see the following error:</p>
  
  <pre><code>Cannot delete or update a parent row: a foreign key constraint fails
  (`my_localdb`.`receipt_health_service`, CONSTRAINT 
  `FK96DE98B9D3292D2C` FOREIGN KEY (`receipt_id`) REFERENCES `receipt`(`id`))
  </code></pre>
  
  <p>Why do this happen? Why the Receipt_HealthService instances are not automatically deleted? What do I need to change to allow the automatic deletion and remove the error?</p>