Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate update on single property updates all properties in 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();
               }
           }
like image 568
NabilS Avatar asked May 01 '09 20:05

NabilS


1 Answers

This is the normal behavior. You can try adding dynamic-update="true" to your class definition to override this behavior.

like image 57
Darin Dimitrov Avatar answered Oct 05 '22 11:10

Darin Dimitrov