sthorogood wrote:
I think you just need to use the following:
<many-to-one name="CategoryInformation" column="CategoryID" cascade="none" />
the cascade indicates that any changes to Category will not be persisted when Order is saved.
Actually, that's not what cascade="none" does. I think there are actually a lot of misunderstandings about how saving/updating works within NHibernate. If you load the Category and Order from the database in an NHibernate session any changes made to either will be persisted through to the appropriate table based on changes with the business objects. There is no need to call Save(), simply Flush() your changes. So assuming he isn't always using transient objects and then calling Save() or Update() or SaveOrUpdate() your described cascade won't really change the behavior.
That being said I have no clue why this question is even being asked. Why are you thinking the category table will be changed? If you change your order to reference a different category the appropriate order table will be updated with the categoryId of the new reference. Isn't that exactly what you want? If you didn't change the category it won't change the category table.
What issue are you currently seeing?