开发者

nHibernate Mapping file

开发者 https://www.devze.com 2022-12-30 08:31 出处:网络
<property name=\"NetworkRunId\" column=\"Network_Run_Id\" /> <property name=\"StudyKey\" column=\"Study_Key\" insert=\"false\" update=\"false\" />

<property name="NetworkRunId" column="Network_Run_Id" />
<property name="StudyKey" column="Study_Key" insert="false" update="false" />
<property name="AnnualizationFactor" column="Annualization_Factor" />
<property name="CreateDate" column="Create_Date" />
<property name="ModifyDate" column="Modify_Date" />

<many-to-one name="StudyInfo" class="Study" lazy="false" cascade="save-update">
  <column name="Study_Key" />
</many-to-one>

<many-to-one name="Mem开发者_如何学编程berInfo"
             class="BusinessDataEntities.Domain.NetworkAdministration.VHAMemberCompany, BusinessDataEntities"
             lazy="false">
  <column name="Member_ID" />
</many-to-one>

<many-to-one name="NetworkRunStudyXrefInfo"
             class="BusinessDataEntities.Domain.NetworkAdministration.NetworkRunStudyXref, BusinessDataEntities"
             lazy="false">
  <column name="Network_Run_Id" />
</many-to-one>

<join table="[HCO_Spend_Network_Run_Study]">
  <key column="HCO_Spend_Id" />
  <property name="NetworkRunId" column="Network_Run_Id" insert="false" update="false"/>
</join>

issue with the

Network run id not exist in the first table but i have a join that is having the Network_Run_Id as property how do i fix this


If the column NetworkRunId is your primary key, then map it with the <id> element.

<class ...>
    <id name="NetworkRunId" column="Network_Run_Id">
        <generator class="identity"/>
    </id>
</class>

As for the generator class, choose whichever best fits with your underlying database engine.

EDIT #1

In order to map a many-to-many association, you might want to take an eye on the documentation about Collection Mapping. Perhaps scrolling down to 6.3 will answer your question.

0

精彩评论

暂无评论...
验证码 换一张
取 消