-->
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: flush question
PostPosted: Sun Jan 25, 2004 8:33 pm 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
Suppose I have the following situation:
One table is selected and one object is retrieved. i perform changes in this object, and then flush the session. ok, the changes are going to be noticed and updated.
But, if for a special reason, i have to add another object to the same table, before flushing the modifications of the first retrieved object (the first object has nothing to do with the second.they are members of the same table. no integrity relations between them). Do I have to flush the session to save the modifications in the first object before saving the second one? is it possible to flush the session twice?

Example:
Code:
Object one = (Object)session.load(Object.class, id);
one.setThis(...);
one.setThat(...);
Object two = new Object();
two.setThis(...);
two.setThat(...);
session.save(two); // save the new instance
session.flush();// flushes all, and updates the object one modifications.



This is setting things whith wrong ids in the tables. so , i get a new Object instance with id 0 in the database table.But forget the results. just tell me if this is ok. if not, any help? ;)))

Thanks a lot.

_________________
Ot


Top
 Profile  
 
 Post subject: Re: flush question
PostPosted: Mon Jan 26, 2004 1:46 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
[quote="Ot

_________________
Emmanuel


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.