Hello
I've got the following problem: I have class Product , and the list(ArrayList) of objects Feature (class Feature) in this class This list is mapped by @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL ) Class Feature is not connected to class Product by any relationship. So connection is singledirectional
Hibenate creates a table "prduct_feature" for associating primary keys from both tables
I save class Product by:
Code:
getHibernateTemplate().save(product);
In this case everything saves properly, But if i try to update the product i will meet the following problem:
for example i've got the following lines in table Features: 1 2 3 They all belongs to the same product - product1
if i change 3 to 4 and perform :
Code:
getHibernateTemplate().update(product1);
i will get the following lines in my Features table - 1 2 3 1 2 4 => it means that everytime i update my product i've got new Features list for it
So, i can't understand the reason of such behaviour
Please tell me how can i solve such problem, or is it possible at all? Thanks...