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: difference between ISession.Save & ISession.Flush
PostPosted: Tue Dec 12, 2006 3:18 am 
Regular
Regular

Joined: Thu Aug 24, 2006 2:05 am
Posts: 80
Hi Group,

Please do let me know the difference between ISession.Save and ISession.Flush.

Thanks,
Deepak


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 3:50 am 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
ISession.Save(obj) tells the NHibernate session that the obj needs to be inserted to database. (The INSERT SQL statement is not yet fired)

ISession.Flush() fires the INSERT SQL statement (and all other operations that you have told the NHibernate session by Update(),Delete(),etc) to database.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 4:44 am 
Regular
Regular

Joined: Thu Aug 24, 2006 2:05 am
Posts: 80
Hi Canton,

In our application, whenever application invokes ISesion.Save method, NHibnerate fires a query to the database to perfrom insert opeation.
Does it require any setting in mapping file?

FYI: I am using 1.2.0 Beta1 NHibernate version

Thanks,
Deepak


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 4:50 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
deepakbadki wrote:
In our application, whenever application invokes ISesion.Save method, NHibnerate fires a query to the database to perfrom insert opeation.
Does it require any setting in mapping file?


It depends on IdGenerator class configured. NHibernate needs to assign the ID to object during the "Save" call, so in case of MS SQL identoty, it needs to perform insert. In case of Oracle sequence, the next id is obtained from sequence. etc.

Gert

_________________
If a reply helps You, rate it!


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.