• Post Reply Bookmark Topic Watch Topic
  • New Topic

Uni-direction ManyTomany mapping with annotations

 
Sonx Nkuks
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a Basket class mapping ProductItem class with ManyToMany relationship. I only did the mapping on Basket

I would like to know if ProductItem will be updated if i execute hibernate update on Basket ... Say i have on ProductItem productA, productB, productC which are contained on the Basket (hence the relationship). If i remove productA (i do this by creating a new basket with only productB and productC then persist the new basket using update), would ProductItem table be updated? if not, how should i achieve this...
 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would rather ask why a unidirectional many-to-many relationship would make sense. This is contradictory by nature IMHO. In a many-to-many relationship there's no real owner, so the target side should be able to access the other as well.

Karsten
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!