• Post Reply Bookmark Topic Watch Topic
  • New Topic

Should CASCADE only be specified on the owner side of a bi-directional relationship ?  RSS feed

 
Linwood Hayes
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have a bi-directional for many-to-many or one-to-many relation (i.e. each side have access to the other).  For many-to-many and one-to-many there is always an "owner" and a non-owner.  Should "CASCADE" only be specified on the owner side ?  what happens if

1) CASCADE is specified on both owner and non owner side ?
2) CASCADE is specified on non owner side only ?

Note: we are talking about bi-direction only.

Thanks.
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linwood Hayes wrote:Should "CASCADE" only be specified on the owner side ?  what happens if

1) CASCADE is specified on both owner and non owner side ?
2) CASCADE is specified on non owner side only ?

You might want to read the beginner’s guide to JPA and Hibernate Cascade Types by Vlad Mihalcea (author of the book "High Performance Java Persistence".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!