Hibernate | Many to many mapping | problem in add and delete
Joined: Mar 01, 2011
I have two main tables(account and product) and a junction table account_product which contains thier association. product is kind of my look up table. one account may have multiple products and a product may be associated with many accounts.
1. When I add data, data should be added in account table and account_product table but my product table should be untoched, it should work like a lookup table.
2. When I update data, data should be updated in account table and its association table - account_product. For example if product 2,3 are already assoiated with account and now I want to associate product 5,6 only then association of 2,3 should be deleted from account_product table. product table should be untoched.
I am trying many-to many annotation but everything is getting mess-up.
-> On Add/update, lookup table is being updated.