File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JPA: Cascade delete for join tables with composite key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA: Cascade delete for join tables with composite key" Watch "JPA: Cascade delete for join tables with composite key" New topic
Author

JPA: Cascade delete for join tables with composite key

kombi katisha
Greenhorn

Joined: Dec 03, 2009
Posts: 1
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?
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
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?

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA: Cascade delete for join tables with composite key