0

I have two tables

tblPart
(
    partId,
    subpartId UNIQUE NULL
)

tblSubpart
(
    subpartId
)

So I can only have zero or one subPart associated with the part at the same time.

I'm trying to map this as

ClassMap<Part>
{
    HasOne(x=>x.Subpart);
}

and the convention rewrites the foreign key so it uses subpartId instead of partId.

however generated query ads

subpart.partId

into the query, which does not exist.

What am I doing wrong here?

Vasili Sviridov
  • 191
  • 2
  • 4
  • 14

1 Answers1

0

Why not use inheritance?

Check out this question

Inheritance Mapping with Fluent NHibernate

And this page (search inheritance to jump to the right section)

http://wiki.fluentnhibernate.org/Fluent_mapping

Community
  • 1
  • 1
Zoidberg
  • 10,137
  • 2
  • 31
  • 53
  • The schema was simplified to show the keys and such. In reality two objects have a different relationship, which should not be expressed as subclasses. – Vasili Sviridov Aug 26 '10 at 18:07