-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: get() / load()
PostPosted: Mon Jun 07, 2004 7:29 am 
Beginner
Beginner

Joined: Thu Oct 30, 2003 6:29 am
Posts: 30
Location: Germany, KA
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


Top
 Profile  
 
 Post subject: Multible Instances
PostPosted: Mon Jun 07, 2004 2:04 pm 
Beginner
Beginner

Joined: Thu Oct 30, 2003 6:29 am
Posts: 30
Location: Germany, KA
why is it necessary to have multible instances of an entity in a single session, anyway? Why can't hibernate give me the one instance, independently of what I am using to get the object. Using a finder would be great sometimes, instead I have to iterate through Collections and stuff to get access!

thanks marie


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 3:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Try to isolate your problem in a simple testcase - if it persists, show the code.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.