hi,
I am stuck with a annoying net.sf.hibernate.NonUniqueObjectException. Assume a entity 'Blueprint' that can have multible entities 'Relation' to it. Relation itself has two 'Blueprints' called 'LeftClass' and 'RightClass'. If have two Relations assigned two a 'Blueprint' that both have the same 'Blueprint' as 'RightClass', hibernate starts crying (actually I am near to crying, too)
I know, I can't use a find() or a load() if I am setting an object that already is associated to the session, and - I swear - I am trying to set all associations using references to exisiting instances. But, why is the get() method not working? I understand the documentation for get() in that way, that I can avoid instanciating a new object but get a reference to the existing instance if it is already loaded by the session.
I think the problem is: I have a Relation attached to my Blueprint. Save. Done. Now I open a new hibernate session, retrieve my BluePrint, add another Relation with the same "RightClass" thus leading to a instance of the "RightClass" by using get() and another instance that is already associated by the first Relation.
Is there a way to make hibernate manage than instance-stuff? I tried using 2.1.3 and 2.1.4. It is a little hard to paste some code because hibernate is deeply burried in my app, by now.
thanks
marie
|