Without knowing what you're trying to accomplish, you might consider doing it some other way. An CLR object will have the same type as long as it lives and because an orm is trying to sort of minimize the feeling that "objects" sometimes resides in a db during its life time, this isn't something nh supports AFAIK. To be able to switch the type by letting nhibernate change some column or similar in the db to get the feeling that the entity suddenly would be a new type, would IMHO be wrong.
Anyhow - your exception is caused because you trying to reuse the old OID I think. You need to kill the cat and give birth to a new dog with a new OID, not trying to converting the cat to be a dog (or whatever types you have). /Roger -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of roend Sent: den 27 januari 2010 15:51 To: nhusers Subject: [nhusers] Downcasting in Table Per Class Hierarchy Does NHibernate have a method of downcasting a table per subclass inheritance mapping? I'd like to insert an object into the database with the base type and later convert it to a derived type. I've tried creating a new instance of the derived type and copying over all the properties, but NHibernate gives me a NonUniqueObjectException when trying to save. Is there a way to do this, or am I going to have to change my design? Thanks, Nathan -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
