1
다음 nhibernate 매핑이 있는데 일대일 매핑으로 다른 엔티티 TimesheetCellTransactionLine의 별도 열에 복합 키 값을 저장하려고합니다. 어떤 아이디어? 다음과 같은 값을 저장하지 않으면 양쪽 외래 키 열에 null이 전달됩니다.nhibernate에서 복합 키를 이용한 다 대일 매핑
<hibernate-mapping
xmlns="urn:nhibernate-mapping-2.2"
assembly="ManpowerUK.Indigo.Domain"
namespace="ManpowerUK.Indigo.Domain.Timesheets">
<class name="CMSTimesheetCell" lazy="false" table="vw_TimesheetCell" mutable="false">
<composite-id >
<key-property name="TimesheetCellId"/>
<key-property name="TimesheetCellVersion" column="Version"/>
</composite-id>
<property name="TimesheetId" not-null="true" />
<property name="IsRemoved" />
</class>
</hibernate-mapping>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="ManpowerUK.Indigo.Domain" namespace="ManpowerUK.Indigo.Domain">
<class name="TimesheetCellTransactionLine" lazy="false">
<id column="TransactionLineId"/>
<many-to-one name="Timesheet" class="ManpowerUK.Indigo.Domain.Timesheets.TimesheetCellWrite" column="TimesheetId" not-null="true" lazy="proxy"/>
<many-to-one name="CMSTimesheetCell" class="ManpowerUK.Indigo.Domain.Timesheets.CMSTimesheetCell" not-null="true" lazy="proxy" cascade="none">
<column name="TimesheetCellId"/>
<column name="TimesheetCellVersion"/>
</many-to-one>
</class>
</hibernate-mapping>
귀하의'TimesheetCellTransactionLine' 더 큰지도에서 추출 된 것으로 보인다 스 니펫이 잘못 보인다 (클래스 정의 밖의'subclass') 테스트되지 않습니다. [mcve] (/ help/mcve)를 쓸 수 있습니까? –