I thnk you need to get rid of the call to evict before the save and things should start working.
John Davidson On Sun, May 2, 2010 at 2:11 PM, ChriLj <[email protected]>wrote: > No, I'm not using Spring. > > I'll cut out the code that I've written and try to explain what I'm > doing. The code below is only part of the application so what's > causing my problem may not be in these lines (?). > > What I need is to understand why NHibernate seems to consider the > property Status as unchanged. From what I understand the Equals method > is not used for this?? If I remove the row where Evict is called, > nothing is sent to the database. > > ... > priceChangeCase.Status = PriceChangeCaseStatus.Drafted > SaveCase(priceChangeCase); > ... > > private void SaveCase(PriceChangeCase priceChangeCase) > { > using (var scope = new > TransactionScope(TransactionScopeOption.Required, > SavePriceChangeCaseTransactionTimeout)) { > priceChangeCaseRepository.Evict(priceChangeCase); > priceChangeCaseRepository.Save(priceChangeCase); > priceChangeCaseRepository.Flush(); > scope.Complete(); > } > } > > public virtual void Evict(object entity) > { > Session.Evict(entity); > } > > public override void Save(PriceChangeCase entity) > { > Session.SaveOrUpdate(entity); > } > > public virtual void Flush() > { > Session.Flush(); > } > > > BR, > Christina > > > > > > > On Apr 30, 1:39 am, John Davidson <[email protected]> wrote: > > Are you using Spring? What happens if you call Flush instead of Evict? > > > > John Davidson > > > > On Thu, Apr 29, 2010 at 10:35 AM, ChriLj <[email protected] > >wrote: > > > > > > > > > > > > > Hi, > > > > > I'm updating a property of an entity, but when saving I have to use > > > Evict otherwise no update sql is sent to the db. > > > > > How does NHibernate check which properties that are "dirty"? What > > > triggers it to save or not? > > > > > Thanks > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "nhusers" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > > For more options, visit this group athttp:// > groups.google.com/group/nhusers?hl=en.- Hide quoted text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
