-->
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.  [ 3 posts ] 
Author Message
 Post subject: Non-dirty (unchanged) properties getting updated...
PostPosted: Tue Sep 13, 2005 4:41 am 
Newbie

Joined: Wed Aug 31, 2005 9:29 pm
Posts: 14
For some reason a particular persistent object of mine keeps updating non-dirty properties. I've added an interceptor and I can confirm that those values in previousState and currentState are the definitely the same.

My understanding is that if you use ISession.Load to acquire the instance and the update on the same session, only the changed properties should be updated.

Are there any common reasons for this? Or do I need to post my code and mappings?

My code that does the update:

Code:
using (ISession session = Global.Factory.OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
   Invoice invoice = (Invoice) session.Load(typeof (Invoice), invoiceID);
   invoice.InvoiceNum = InvoiceNumber;
   session.Update(invoice);
   session.Flush();
   transaction.Commit();
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 11:09 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Did you enable dynamic updates in your mappings? (<class dynamic-update="true">) Dynamic updates are off by default.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 8:43 pm 
Newbie

Joined: Wed Aug 31, 2005 9:29 pm
Posts: 14
Excellent thanks!
Just curious, when wouldn't you want dynamic updates? Is it just the performance hit of building a statement for every update?
What if I wanted to use static sometimes (for batch updates) and dynamic other times with the same persitent type?


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