Hi all,
We have a problem with NHibernate Inheritance, we have this structure
Entity -> Person -> Employee -> WebUser
First we have an old simple object: Entity, that has all the properties, now we use hierachy with inheritance, all ok, but we create a job to update the old records and update this to the new structure; the problem is, when we create a derived of Entity object (we set correctly the Id's, new Id equals old Id) and make an update, NHibernate create a new Entity object with a diferent Id.
Example:
Code:
[new structure] = [old structure]
Person.Id = Entity.Id
Person.Name = Entity.Name
Person.Mail = Entity.Email
and make an: Update(Person);
Nhibernate create a new Entity in DB, don't reference the new object (Person) to the old Entity by Id
How can we handle this, and avoid the creation of new Entity object, and just update the foreing key of the derived object?