Hi,
It's really hard to understand exactly what your problem is, but I will take a stab at it. I believe you are saying that you have entities in one table and you have the parent-child relationship in a relationship table.
You have to be careful in this case. You must create the parent (insert it) before relating the child to it. You mustn't try to relate the parent to the child before saving the child. You mustn't try to relate the child to the parent before saving the parent. You may insert the parent, insert the child, and then create the relationship and update them. You may also insert the parent, then relate the child to the parent and insert the child.
Make sure that the child is the owner of the relationship. This means that when you insert the child with the parent related, at the moment hibernate will insert the relationship into the relationship table.
I hope that helps. I can give you real examples if you need (I just did this for a project I'm working on).
kim
|