我正在尝试在3个表之间创建关系。以下是表格:
房间表包含
设施表包含
facilityMapping表包含
在facilityMapping表中,我想创建对上面两个表的引用。
在service.xml中,我正在尝试创建Reference
<service-builder package-path="com.admin.services">
<namespace>rbms</namespace>
<entity name="rooms" local-service="true" remote-service="false">
<column name="roomId" type="int" primary="true"></column>
<column name="roomName" type="String"></column>
<column name="roomFloorNo" type="int"></column>
<column name="roomLocationName" type="String"></column>
<column name="roomCapacity" type="int"></column>
<column name="roomImages" type="String"></column>
</entity>
<entity name="facilities" local-service="true" remote-service="false">
<column name="facilityId" type="int" primary="true"></column>
<column name="facilityName" type="String"></column>
<!--
|- Finding Equipments using their Names and display it in form
|- It will help you to add new Room.
-->
<finder name="facilityName" return-type="Collection">
<finder-column name="facilityName"></finder-column>
</finder>
</entity>
<entity name="facilityMapping" remote-service="false" local-service="true">
<column name="facilityId" type="int"></column>
<column name="roomId" type="int"></column>
<column name="facilityQuantity" type="int"></column>
<column name="fk_fid" type="Collection" entity="com.admin.services.facilities" mapping-key="facilityId"></column>
</entity>
</service-builder>
错误:必须为元素类型列声明mapping-key
答案 0 :(得分:0)
由于在新的Liferay版本中不推荐使用mapping-key,因此我使用mapping-table属性完成工作