Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JPA: Cascade delete for join tables with composite key

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having an issue where I have table B has a manytomany relationship to table C and table D. I am using a table B_has_C_and_D to link.

I would like to be able to delete a row in table C and have the relationship also delete the row in table "B_has_C_and_D"

Entity B:

Entity bHasCAndD:

Entity C:

Entity D:


I figure I have something just misconfigured. Anyone have any ideas/recommendations?
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the issue? What error or incorrect behavior are you seeing?

In general the cascade=ALL should cause the related B_C_D object to be deleted if you call remove() on C.
What is your code doing exactly?
    Bookmark Topic Watch Topic
  • New Topic