I am wondering what better design would be to continue a new child with NHibernate without accidentally overwriting the parent in the database.
The problem is that the child will look something like this:
class Child { Parent Parent;
My problem is that the child was provided from the user interface level along with the parent ID, which means that Parent ref is basically uninitialized: it will have an identifier, but everything else is zero - because the only way to fill in its fields was It would be an extra trip to the database to read them.
Now, if I call Session.SaveOrUpdate(child) in NHibernate, what happens to the parent. I do not want NHibernate to cascade with the exception of an uninitialized parent, as that would simply destroy the data in the database. How do people approach this problem? Any best practices?
source share