• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

ManyToMany deletion issue

 
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello;

I have an Entity called Audit with a member called Materials which is a collection of Material Entities:



In Material I have:



The table that is created is:



This what I would expect. However the issue I have is I can't delete an Audit without getting a 'Cannot delete or update a parent row: a foreign key constraint fails' exception on this table.

I have been reading through the Annotations reference guide and I am still not sure how to map this so I can delete Audits and have the Materials persist but the material_audit mappings removed. Its actually not even important for me to ever list all the Audits for a material, (I only want to show an Audit and its associated Materials) so I may not need the Audits member in Materials (if that helps at all).

Any tips would be great.

Thanks,
Luke
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic