• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

many-to-many relationship with annotation

Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In hibernate, I have an object like below, People has many-to-many relationship with Project, I want to achieve these functions:

1. when saving a new People, don't save ProjectList and its relationship.
2. when updating a People, don't update ProjectList and its relationship.
3. when deleting a People, delete People and its relationship, but keep Project object
4. when searching with HQL, like normal class, its inner join should be working.

In conclusion, the key part is in saving-new and updating. how to achieve this using annotation ?


It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic