-->
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.  [ 2 posts ] 
Author Message
 Post subject: Moving an object Between Persisted Collections
PostPosted: Wed Jul 09, 2008 12:44 pm 
Newbie

Joined: Fri May 05, 2006 12:09 am
Posts: 11
I think I may have a problem with my design but I wanted to figure out if I could do this. This is a driver routing system, where a driver has a number of stops assigned to him and he then enters information about what happened at that stop (i.e. a deliver was made or not and why not), those stops are stored in a IList as part of the driver. The situation is that there are times where those stops have to be change to different drivers but the history needs to stay the same. I at first thought I could just take the stop add it to the other drivers collection and remove it from the first driver. If I do that though I get

a different object with the same identifier value was already associated with the session: 1554b92f225f4f3592a73680f201abae, of class: TreaterDAL.CompTreatSheet

Am I looking at this from the wrong direction?[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 7:51 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
This error occurs when you do a session.Save() on a object that is already in the session. I suppose you do this after you moved the stop to another driver ? As long as you are doing all that in the same session, there's no need for an explicit Save(). Just flush the session or commit the transaction and the changes will be persisted.

If that's not your problem, post your code.

_________________
--Wolfgang


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