在class A的映射文件中,有下面代码
<map name="ClassB" table="TableB" lazy="true">
<key column="" /><!--这个地方应该写什么,因为A的主键是由好几个字段构成的,应此不能只写一个column呀-->
<index ...>
<one-to-many class="EntityB"/>
</map>
<p>
|
看了看reference的文档,关于
的解释如下:Collection instances are distinguished in the database by a foreign key to the owning entity. This foreign key is
referred to as the collection key . The collection key is mapped by the <key> element.
我想上文中的“owning entity”,就应该是EntityA(它包含了一个EntityB的集合),所以
应该是指TableA的主键,现在的问题是:
标签中的column属性只允许填充一个字段,而EntityA却是一个composite-id,含有好几个字段,让我比较搞不清状况了。这就是我的问题所在。
不知道我理解的对不对,请各位指教。谢谢