Nhibernate multiple levels hierarchy mapped as joined subclasses fails to work with base class property
I have following hierarchy:
ClassA->ClassB->ClassC->ClassD
ClassB has PropertyA. All classes are mapped as joined subclasses with table per-class.
Mapping is parsed with no errors but I get an error when I try to run a query:
ICriteria crit =session.CreateCriteria(typeof(ClassB));
crit.Add(Expression.Eq("PropertyA", value));
crit.List<ClassB>();
Error is as follows:
NHibernate.QueryException: could not resolve property: PropertyA of: ClassC
I seem to get another related error when persisting instances of ClassD but I'd rather fix this one first.
Why does it happe开发者_高级运维n?
Disregard this. My mapping was not valid - I should use multiple level joined-subclass hierarchy mapping:
<class
<joined-subclass
<joined-subclass
...
not linear mapping with extends attribute.
精彩评论