Good point
2014/1/23 Ted P <[email protected]> > Let's say I have a Parent entity and a Child entity but they are mapped > with no cascade save of the Child entities, and I forget to call Save() for > the Child entity like so: > using(var s = sf.OpenSession()) > using(var t = s.BeginTransaction()) { > var newParent = new Parent() {Name = "NewParent"}; > var newChild = new Child() {Name = "NewChild", Age = 10}; > newParent.AddChild(newChild); > s.Save(newParent); > t.Commit(); > } > > This will throw an exception similar to this: > *"object references an unsaved transient instance - save the transient > instance before flushing or set cascade action for the property to > something that would make it autosave. Type: NHibernateLab.Models.Child, > Entity: NHibernateLab.Models.Child"* > > All of this is all fine. But now, let's pretend there are lots of > different types of entities that have a one-many relationship with the > child entity types, how can I find out what type of entity it is that we're > trying to save that has a reference to the transient Child entity that > causes the exception? Is this possible? Can I dig through the session's > sessionimpl somehow to find out? > > > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.
