There is not enough information to do a complete troubleshoot for you. However, try making the SalesPersonId property in your C#/VB class a Nullable<int> (or "int?" in C#). When NHibernate retrieves the row from database, it gets a NULL. When the session is flushed, NHibernate sees a zero; therefore, it thinks that you have changed it, thus issues an update. The reason Load() does not cause the same problem is Load() creates a lazy proxy; and it does not actually hit the database until you access the object's properties. If the proxy has not been initialized, then NHibernate concludes that it has not been updated.
At any rate, all of the above are speculations. Please include more information if it does not solve your problem.
_________________ Karl Chu
|