Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2.6
Mapping documents:
Name and version of the database you are using: MySql 5.0.11
Hi all,
my scenario:
many-to-many bidirectional association between A and B
In my app, first I create and persist both objects.
Then I open a dialog to modify object A assigning to it object B, then update db these changes.
public void addB(B b) {
b.addA(this);
bObjects.add(b);
}
Now, when I try to get objects B from A is all OK.
But when I try to get objects A from B it results in a empty set...
My doubts are, that when I open the dialog showing all objects B, I perform a query on DB, resulting in new instances of B objects....and so when i call
addB(...) method having a different instance of B object, the collection results right for current instance and wrong for the first created B object.
I would like to know how to make the changes of a instance of B visible to the other instance of B considering that their identifier on DB is the same, and so they are the same entity.
Thanks in advance and best regards
Gamby