What would cause a change to not generate an update statement for an existing entity? I have a command that updates a status enum on an entity. It changes it from Active to Deleted. I use the same command (generically) to update the status bit on other entities without a problem. I can update a single string on the entity in question without changing anything else and the update processes fine. I can observe all this going down in NHProf…
I guess my questions then are:
- What would cause NHibernate to not update an entity when an enum value (and nothing else … or other things to?) is/are changed?
- What is the best way to track down issues like these?
Thanks for your help!
A clue. The property on the base type is:
public virtual EntityStatus Status { get; protected set; }
If I make the setter public and assign to it directly, NHibernate picks it up just fine. When it’s protected, I call a method on the entity and update the Status there. Does that provide any clues?
So, this was a fun one and a total pain in the ass to track down. It turns out that using Lazy loading inside of an Any mapping somehow screws the ol’ pooch somewhere. So calling a virtual method to update a protected property does not work when I do this:
But it DOES work when I do this:
Anyway, I really hope this helps someone else crazy enough to use an Any mapping.