单个属性上的 NHibernate 更新会更新 sql 中的所有属性 [英] NHibernate update on single property updates all properties in sql
本文介绍了单个属性上的 NHibernate 更新会更新 sql 中的所有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am performing a standard update in NHibernate to a single property. However on commit of the transaction the sql update seems to set all fields I have mapped on the table even though they have not changed. Surely this can't be normal behaviour in Nhibernate? Am I doing something wrong? Thanks
using (var session = sessionFactory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
var singleMeeting = session.Load<Meeting>(10193);
singleMeeting.Subject = "This is a test 2";
transaction.Commit();
}
}
解决方案
This is the normal behavior. You can try adding dynamic-update="true"
to your class definition to override this behavior.
这篇关于单个属性上的 NHibernate 更新会更新 sql 中的所有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文