-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NHibernate inheritance create new object instead update
PostPosted: Mon May 16, 2011 7:27 pm 
Newbie

Joined: Mon May 16, 2011 7:09 pm
Posts: 3
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.