-->
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: What is correct?
PostPosted: Tue Jan 06, 2004 10:34 pm 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
I have the following situation:

In a httpSession (I'm using struts) i have a bean which holds a collection of type A, a collection of type B, an instance of a C object. The objects in collection A are already present at the database, and have been previously loaded. This session gets this way when I reach the last step of a process of getting info about a new user. So, when I have all this data in hands, I have to connect them, so all of them can be persisted. The new data is going to be related to those in the collection A, which are already present in the database.
A completely fresh object is going to appear, and is going to be related to all this data.
the question is: is there an especific order to handle this info, call each setter methods (remember: each setter method passes one of these objects as arguments)? Do I save the new bean before or after saving all the rest?
I know the question is not well formed...but, the main is: is there a correct order to call session.save(obj) for each object ?

Thanks

_________________
Ot


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 12:05 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
I'm sorry, Ot


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 12:14 am 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
thanks a lot for your reply, but i found a way to do it almost completely. the problem now is about the collection which has data loaded in a previous session. i can set all attributes of the other instances (they are all new objects i'm going to insert in the DB). but when touching the data previously loaded, i get this:
Code:
Another object was associated with this id (the object with the given id was already loaded):


The collection is full of "lotes" instances. those instances where retrieved in a previous moment in my application flow. now i need to relate them whit new data i'm creating now, and update those "lotes".
what am I missing?

thanks

_________________
Ot


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 3:46 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Either you session lifetime is loo long, or your design isn't that good (loading an object and try to update a transient version of is)
Have a look at session.evict().

_________________
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.