It seems like dynamic-update attribute doesn't work without select-before-update attribute.
I have an entity named Person. Person has an column named AddressUid
, that refers to AddressUid of Address table.
now I retrieve one object of Person as
Person Per = Context.FindUnique("PersonUid=''");
Then I change the LastName of the Person as
Per.LastName = "Abcd";
Then I save the object to the database
as Contect.Save(Pers).
The changes are reflected to the database , but the profiler shows an update query fired on the Address table as well , even when I didn't do any changes to the Entity Address.
but everything works fine when I use select-before-update="true", and obviously this fires select query on Person and Address.
Does dynamic-update work without select-before-update?
Also to reduce the overhead caused by the select queries due to select-before-update="true", I enable second level cache but unfortunately NHibernate didn't look into it while updating the object. It hit the cache when I simply use _session.Get<Person>(1), but not internally when I use _session.SaveOrUpdate(objPerson).
Any idea why does it not hit the cache?
|