I have two classes I would like to persist via NHibernate:
– Cat, which has a name and an Id,
– Kitten, which is a subclass of Cat (no extra public properties).
For stupid reasons, I would like to know if it is possible to map Cat only? So that when I persist Kitten, it is saved as a Cat and when I reload it, it is loaded as a Cat.
Additional constraints :
– When trying, NHibernate crashed because it did not know Kitten.
– However I do not want to add a discriminator value, as I do not want Hibernate to instantiate the Kitten subclass.
Thank you very much!
EDIT :
I forgot to write that using explicit ISession.Save("Cat", kitten) works. My problem occurs during a cascading save.
Best Answer
Old question, I guess I would have to use interfaces instead.