Hello,
I am using hibernate 3.0. I have mapped a bidirectional many to many association beetwen two tables using an association table. My query are working fine, so my mapping seems ok. However, I just don´t know how to create an association by code.
I have classes A and B. A has a property called bSet and b has a property called aSet. If I just use:
A a = session.load(...);
B b = session.load(...);
a.getBSet().add(b); // and/or b.getASet().add(a);
session.save(a);
I get an error saying that there is alredy an object with the same ID. However, I have NO ROWS in my relation table in database.
What am I doing wrong?
_________________ gtalk: mvallebr at gmail.com
|