我有以下映射:
<class name="xxx" table="t1" schema="s1" lazy="false">
<composite-id>
<key-property name="OperatorId" column="OPERATOR_ID" />
<key-property name="GID" column="GID" />
</composite-id>
<property name="StationName" column="NAME" />
<join table="t2" schema="s2" optional="true">
<key column="GID" property-ref="GID" />
<key column="OperatorId" property-ref="OperatorId"/>
<property name="NumberOfKM" column="NumberOfKM" />
</join>
</class>
似乎我无法在连接中添加多个键, 为什么?我该怎么办呢?
由于
答案 0 :(得分:0)
试试这个:
<class name="xxx" table="t1" schema="s1" lazy="false">
<composite-id>
<key-property name="OperatorId" column="OPERATOR_ID" />
<key-property name="GID" column="GID" />
</composite-id>
<property name="StationName" column="NAME" />
<join table="t2" schema="s2" optional="true">
<key>
<column name="GID"/>
<column name="OperatorId"/>
</key>
<property name="NumberOfKM" column="NumberOfKM" />
</join>
</class>
Rember that
<key>
<column name="GID"/>
<column name="OperatorId"/>
</key>
对于t2
上的加入,请参阅t2
中的关键列。