nHibernate 2.0 - mapping a composite-id *and* many-to-one relationship causes “invalid index” error

前端 未结 1 581
青春惊慌失措
青春惊慌失措 2020-12-15 19:01

I have a problem. Imagine this data model:

[Person] table has: PersonId, Name1  
[Tag] table has:  TagId, TagDescription  
[PersonTag] has: PersonId, TagId,         


        
相关标签:
1条回答
  • 2020-12-15 19:38

    Kay, here's the answer. Little-to-no documentation on this:

    <composite-id name="PersonTagKey" class="PersonTagKey"> 
      <key-many-to-one name="Person" column="PersonId" lazy="proxy" class="Person">
      <key-many-to-one name="Tag" column="TagId" lazy="proxy" class="Tag"/>
    </composite-id>
    

    This will allow you to create a composite-id made up of the inverse of a many-to-one relationship.

    Good hunting...

    0 讨论(0)
提交回复
热议问题