Hi,

how you are solving this Problem:

classes:
Code:
Class Category {
 String name;
 List products;
}

Class Product {
 String name;
}
where the relation is n:m
so you have 3 tables: category, products and category_products

the select can be done verry simple with a join.

inserting a product is also simple, only one insert

but inserting a category is complex,
i need one insert for the category and N inserts for N Category.products

this seems to be the onyle solution, or i'm wrong ?

but how i best update the category ??
if my dao gets the category for Update, i can do 2 thinks:

first:
i delete all relations between category and product for this category and re insert the (maybe) new ones.

second: i select all old relations from this db, compare them with the new one and create delete or insert statements for each releation.


its long time ago i worked with rdbms and jdbc directly, hope this questions are not to bad.

what solutions would you prefer, or what other better solution you have ?

thank you verry much

mfg Gideon