Free subclass of nhibernate map in rc

I compiled a free nhibernate 1.0 rc with nhibernate 2.1 and had a few warnings after fixing the errors.

Fluent nhibernate tells me to use a separate subclass table instead of JoinSubclass.

Current mapping:

 public class ClientMap : ClassMap<Client>
{
    public ClientMap()
    {
        LazyLoad();
        Id(x => x.Id);

    //some boring stuff in between

     JoinedSubClass<Company>("Id", m =>
            {
                m.LazyLoad();
                m.Map(x => x.Name);
                m.Map(x => x.Form);
            });
}

      

Classes are inherited (company: customer).

I tried a new mapping like this:

    public class CompanyMap : SubclassMap<Company>
{
    CompanyMap()
    {
        LazyLoad();
        Map(x => x.Name);
        Map(x => x.Form);
    }
}

      

After this change I have no companies, I am not sure how hibernate knows correctly what to do. Before I say "look, I have this class and subclass that I give you right now in your mapping" and now: "Here are two views, draw yourself, thanks" :)

Any advice on how to adjust the fix for the new subclass?

Update: Now I figured out that this works for persisting data, but the fk id is not being written to the child. How do I match FK? The field name is Client_id as nhibernate expects fk .. field names.

+2


source to share





All Articles