Please show us your mappings. You should have:
ClassMap<Person> SubclassMap<Teacher> SubclassMap<Policeman> On Aug 6, 3:32 pm, Luka <[email protected]> wrote: > ups my error! > > I have this problem: > public class Person:DomainBase<Person,int> > { > public string Name; > > } > > public class Teacher: Person > {... > > } > > public class Policeman:Person > {... > > } > > All classes are mapped using fluent nhibernate. > The inheritance is mapped by: SubClassMap<Person>. > > In code I am doing this: > IPersonRepository rep = > ObjectFactory.GetInstance<IPersonRepository>(); > var teachers = rep.GetAllTeachers(); > var policemans = rep.GetAllPolicemans(); > > The error I am getting is this: > > Object with id: 1 was not of the specified subclass: Policeman > (loading object was of wrong class [Teacher]). > > in the database I have i person with ID 1 that is a teacher and a > policeman. > > How to solve this problem? -- 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.
