views:

307

answers:

0

I compiled the fluent nhibernate 1.0 rc with nhibernate 2.1 and had several warnings after the errors were fixed.

Fluent nhibernate tells me to use a separate Subclass-map instead of JoinedSubclass.

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);
            });
}

The classes are inherited (company : client).

I tried the new mapping as follows:

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

After this change I don't get any companies, I'm not sure about how hibernate correctly knows what to do. Before I sayd "look, I have this class and the subclass I give you straight away in your mapping" and now: "Here are two mappings, figure by yourself, thx" :)

Any advices how to get the new subclass-mapping corrected?

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