• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what will happen if we save from the non owner side of a many-to-many bi-directional ?

 
Linwood Hayes
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a bidirectional many-to-many relation, since the non owner side also has access to the owner object, does hibernate allow you to save from the non owner side instead of from owner side ??

Thanks.
 
Roel De Nijs
Sheriff
Posts: 10662
144
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:For a bidirectional many-to-many relation, since the non owner side also has access to the owner object, does hibernate allow you to save from the non owner side instead of from owner side ??

Honestly I have no clue. But I do know that it is your object model's and application's responsibility to maintain the relationship in both direction. There is no magic in JPA, if you add or remove to one side of the collection, you must also add or remove from the other side. More info can be found in the excellent Java Persistence WikiBook.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic