| Author |
Hibernate | Many to many mapping | problem in add and delete
|
Sujeet sharma
Greenhorn
Joined: Mar 01, 2011
Posts: 6
|
|
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.
account
----------
acct_num
active
---------
product
---------
prod_id
prod_desc
--------
account_product
------------------
acct_num
prod_id
------------------
Following are my requirements -
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.
As I am new to hibernate so struggling alot.
Appriciate any help.
|
 |
Deepak Kumar Jena
Ranch Hand
Joined: Sep 08, 2010
Posts: 64
|
|
|
Post the code snippets to trace the root cause.
|
dkj4jdk
|
 |
Sujeet sharma
Greenhorn
Joined: Mar 01, 2011
Posts: 6
|
|
Deepak Kumar Jena wrote:Post the code snippets to trace the root cause.
Deepak,
I have doen few changes in my problem statement. Can you please look into it again? I'll post my code soon.
Regards,
Sujeet
|
 |
 |
|
|
subject: Hibernate | Many to many mapping | problem in add and delete
|
|
|