Any examples of mapping using TablePerHierarchy?

I'm having issues trying to get it up and running. Getting
NHibernate.MappingException: No persister for [SubClass] exceptions. I
must be doing something wrong:


       var mapper = new ConventionModelMapper();

        var baseEntityType = typeof(DomainEntity);
        mapper.IsEntity((t, declared) =>
baseEntityType.IsAssignableFrom(t) && baseEntityType != t && !
t.IsInterface);
        mapper.IsRootEntity((t, declared) =>
baseEntityType.Equals(t.BaseType));

        mapper.Class<DomainEntity>(map => map.Id(x => x.Id, m =>
m.Generator(Generators.Identity)));

        mapper.Class<Event>(e => e.Discriminator(map =>
                                                     {
 
map.Column("type");
 
map.Type(NHibernateUtil.String);
 
map.NotNullable(true);
                                                     }));

        mapper.Subclass<Molt>(x =>
                                  {
                                      x.DiscriminatorValue("Molt");
                                  });

       mapper.Subclass<Feeding>(x =>
                                     {
 
x.DiscriminatorValue("Feeding");
                                     });

        mapper.BeforeMapClass += (mi, t, map) => map.Table("myapp_" +
t.Name.MakePlural());
        mapper.BeforeMapBag += (insp, prop, map) =>
map.Cascade(Cascade.All);

        return mapper;

More details on SO: 
http://stackoverflow.com/questions/7351776/nhibernate-conventionmodelmapper-and-subclass

-- 
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.

Reply via email to