-->
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.  [ 5 posts ] 
Author Message
 Post subject: Another object was associated with this id
PostPosted: Fri Jan 09, 2004 10:09 am 
Newbie

Joined: Fri Jan 09, 2004 9:55 am
Posts: 10
Location: Rutland, UK
I'm new to hibernate/struts so please forgive my ignorance.

I'm passing an identifier for one method of my Action which gets the relevant info and puts it into a form bean. I then alter the form bean object and then send the mapping, form, request and response objects onto my save method.

The object is the same as if I had posted a form directly to the save method, but I get the error 'Another object was associated with this id'.

I believe the problem is caused by the fact that my object has already been referenced, but other than that I am lost.

Any help would be very gratefully received.

Many thanks,

Nick


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 11:29 am 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
this is typically because you have 2 objects connected to the session with the same id, but are not == (not the same pointer in jvm)
i suggest you
post your code that talks to hibernate


James


Top
 Profile  
 
 Post subject: Anyway to view what is held in the session
PostPosted: Fri Jan 09, 2004 11:40 am 
Newbie

Joined: Fri Jan 09, 2004 9:55 am
Posts: 10
Location: Rutland, UK
Is there a way that I can view what is stored in the session? I'm using Eclipse in debug mode connected to resin.

Many thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 11:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can use session.evict() on the first object after you dont need it anymore


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 5:26 am 
Newbie

Joined: Fri Jan 09, 2004 9:55 am
Posts: 10
Location: Rutland, UK
jlawmi wrote:
this is typically because you have 2 objects connected to the session with the same id, but are not == (not the same pointer in jvm)
i suggest you
post your code that talks to hibernate


James


I've debugged my way through the code and found that you are right - there is already an object in the session with with same ID as the one i'm trying to add. The problem is that they should be the same object.

Is there anyway I can find out what the difference is betwen these two objects?

Many thanks,

Nick.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.