I've inherited a database schema that maps an inheritance heirarchy to one table using a discriminator column. No problem right? Yes, unfortunately.
The designer has chosen to use the discriminator for the first level of inheritance. Then each subclass uses it's own discriminator field for the next level of inheritance. If NHibernate allowed a discriminator tag in the sub class tag, this would be no problem. Unfortunately, it does not appear that this is the case - when I serialize my mapping attributes it does not render my discriminator tag in my sub class tag. Is this a limitation of NHibernate or the mapping attribute serializer. Any suggestions on how to map this?
Is the normal approach for all sub-subclass to use the same discriminator field as the sub class? If so, Is Nhibernate smart enough that if I query for a subclass it returns all the subsubclass instances?
Thanks very much and keep up the good work,
Jafar
|