I have a class hierarchy, which is mapped in the usual table-per-hierarchy
way.

FooBase
   FooA
   FooB

The parent has two collections, which are lazy by convention:

HasMany(x => x.FooA).Inverse();
HasMany(x => x.FooB).Inverse();

Upon initializing these I was getting WrongClassException.  I noticed that
the SQL did not include the discriminator in the WHERE clause.  This says to
solve it by forcing the discriminator:
https://forum.hibernate.org/viewtopic.php?t=961213.

So in the parent map:

DiscriminateSubClassesOnColumn("Type").AlwaysSelectWithValue();

However,  the doc for AlwaysSetWithValue says it¹s used for legacy cases.
My question is, is there some more correct way to map subclasses that will
also be collections?

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to