The real obj is in RAM because if you have Animal, Dog, Cat and you are querying Animal NH will create instances of the real subclass. If the instance is a Proxy you can't cast it but using session.Load<SubClass>(id) NH should be smart enough to find the requested subclass in the session and not hit the DB.
2010/1/27 Paul Hinett <[email protected]> > I too am interested in a similar scenario where i pass base objects but > then > need to access the additional properties of the subclass...i do know at > runtime what kind of subclass it is. > > Sorry to hijack your question but it's pretty close to what i am after too. > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf > Of roend > Sent: 27 January 2010 14: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]<nhusers%[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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- 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.
