I have traced the call even when the update is unexpected:
public override bool OnFlushDirty(object entity, object id, object[]
currentState, object[] previousState, string[] propertyNames,
NHibernate.Type.IType[] types)
{
return base.OnFlushDirty(entity, id, currentState, previousState,
propertyNames, types);
}
I inspected all currentState and previousState and they are exactly the same.
Why would NHibernate attempt to perform OnFlushDirty when "no" state
whatsoever has changed?
On Wed, Feb 24, 2010 at 1:22 PM, Fabio Maulo <[email protected]> wrote:
> You have Ghosts.
> http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbuster.html
> A ghost may appear because, wrong mapping, stale data (null in DB and not
> nullable property) and so on
>
> 2010/2/24 Billy Stack <[email protected]>
>>
>> All,
>>
>> I have the following scenario:
>>
>> Start Unit of work (SessionFactory.OpenSession())
>>
>> Get collection of Entities (e.g. 10 in size) from db
>>
>> Update only one entity
>>
>> Dispose the Unit of work (Where we call ISession.Flush())
>>
>>
>> The problem I am finding is that 10 update statements are generated -
>> one for each entity in the collection, even though I only actually
>> updated one entity.
>>
>> How does NHibernate think that objects in the collection are dirty
>> even though they weren't updated?
>> I am using nullable types, is this the issue?
>> Ref:
>> http://stackoverflow.com/questions/34852/nhibernate-session-flush-sending-update-queries-when-no-update-has-occurred
>>
>> Is this the right way to be using the Session, should I be calling
>> Session.SaveOrUpdate() ?
>>
>> Any help greatly appreciated...
>>
>> --
>> 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.
>>
>
>
>
> --
> Fabio Maulo
>
> --
> 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.
>
--
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.