-->
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.  [ 4 posts ] 
Author Message
 Post subject: different object with the same indentifier
PostPosted: Mon Jan 10, 2005 10:08 am 
Regular
Regular

Joined: Tue Oct 12, 2004 9:02 am
Posts: 66
Location: Italy
Why if i do:

Student student = (Student) request.getAttribute("account");
Course course = getCourseService().load(id);
getUserService().save(student); // throw expcetion

and instead if I do (I am only inverting 2 operations):


Student student = (Student) request.getAttribute("account");
getUserService().save(student);
Course course = getCourseService().load(id);
...

everything is ok?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 11:59 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
student has a course with the same id, and duplicate objects having the same id is not allowed.
Either do it in correct order or use saveOrUpdateCopy

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 12:38 pm 
Regular
Regular

Joined: Tue Oct 12, 2004 9:02 am
Posts: 66
Location: Italy
emmanuel wrote:
student has a course with the same id, and duplicate objects having the same id is not allowed.
Either do it in correct order or use saveOrUpdateCopy


thanks!
But student has a set of courses loaded lazyly, so it shouldn't know if a course is in its set.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 5:44 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I'm almost sure it's the problem but you don't give enough info to confirm it.

_________________
Emmanuel


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