Problem with NHibernate and saving - NHibernate doesn't detect changes and uses old values.
Posted
by Vilx-
on Stack Overflow
See other posts from Stack Overflow
or by Vilx-
Published on 2010-03-13T22:34:36Z
Indexed on
2010/03/13
22:45 UTC
Read the original article
Hit count: 192
nhibernate
|hibernate
When I do this:
Cat x = Session.Load<Cat>(123);
x.Name = "fritz";
Session.Flush();
NHibernate detects the change and UPDATEs the DB. But, when I do this:
Cat x = new Cat();
Session.Save(x);
x.Name = "fritz";
Session.Flush();
I get NULL for name, because that's what was there when I called Session.Save()
. Why doesn't NHibernate detect the changes - or better yet, take the values for the INSERT statement at the time of Flush()
?
© Stack Overflow or respective owner