-->
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.  [ 6 posts ] 
Author Message
 Post subject: Unwanted updates
PostPosted: Thu Sep 08, 2005 8:00 am 
Newbie

Joined: Sat Jul 09, 2005 1:17 pm
Posts: 17
I have an NHibernate session that is alive for the entire asp.net session. whenever I make changes to the properties of my NHibernate objects without saving these changes NHibernate always issues an update statement anyway when I try to reload the object. Why?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 8:16 am 
Hi Nissim,

That'll be "transparent persistence" at work. The idea is that all changes made to objects will be persisted when a flush occurs, which happens automatically under some circumstances (most notably before a select is executed) even if you disable auto-flush.

It is possible to prevent through some fiddling around with the IsDirty callback in an interceptor, but it's not entirely straight forward.

If you want to know more about transparent persistence you can find plenty of info in the Hibernate forum and Google.

Cheers,

Symon.


Top
  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:45 am 
Beginner
Beginner

Joined: Fri May 13, 2005 11:48 am
Posts: 32
Flush being called automatically is a pain in the ass. How come when we turn off auto flush it still auto flushes? That doesn't make any sense at all. surely there is a reason for it. But what is it?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 1:39 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
Will random flushes even occur if you set ISession.FlushMode to FlushMode.Commit?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 1:50 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
dsellers wrote:
Flush being called automatically is a pain in the ass. How come when we turn off auto flush it still auto flushes? That doesn't make any sense at all. surely there is a reason for it. But what is it?


Of course it doesn't make sense. How do you turn off the autoflush? Using FlushMode.Never or FlushMode.Commit should be enough. The reason for autoflushes is that NHibernate wants to give accurate results for queries by default.

jnapier wrote:
Will random flushes even occur if you set ISession.FlushMode to FlushMode.Commit?


No, they shouldn't.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 1:58 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
Thanks sergey. I was scared there for a second.


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