public void ChangeTheNameOfTheCatFromSmellyToUgly() { Cat smellyCat; using (var session = OpenSession()) { var john = session.Get<Person>(nicePersonId); john.AddCat(new Cat(john) { Name = "Whisky" }); var johnJunior = new Child("John Junior",john) { NickName = "John's FirstBorn" }; john.AddChild(johnJunior); smellyCat = new Cat(johnJunior) {Name = "Smelly Cat"}; johnJunior.AddCat(smellyCat); session.Flush(); session.Clear(); } using (var session = OpenSession()) { smellyCat = session.Get<Cat>(smellyCat.Id); smellyCat.Name = "Ugly cat"; session.Flush(); //if you change the PreUpdateEventListenerImpl to Log.Info on the Master.Name you get an exception } }
public virtual void AddCat(Cat cat) { cats.Add(cat); }