• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

hibernate many-to-many

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do you delete and update a many-to-many relationship in hibernate without deleting the two related objects from the db; that is, I just want to remove the entry in the many-to-many table that joins the two objects, not the two objects themselves.

Thanks for the help
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to ORM.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't used many-to-many relationships with Hibernate yet, but I can make an educated guess.
  • Load one of the objects (A).
  • Find the other object (B) in A's collection of Bs.
  • Remove B from the collection.
  • Save A.


  • I don't think you'll need to do the same from the other side, or if it depends on whether or not it's an inverse association, or if N:N relations can even be inverse.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic