Liferay Service Builder - Creating References

808 views Asked by At

I am trying to create Relationship between 3 tables. Following are the tables:

  • rooms
  • facilities
  • facilityMapping

rooms table contains

  • roomId
  • roomName

facilities table contains

  • facilityId
  • facilityName

facilityMapping table contains

  • facilityId
  • roomId
  • facilityQuantity

In facilityMapping table I want to create Reference to above two tables.

In service.xml I am trying to create 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>

Error : mapping-key must be declared for element-type column

1

There are 1 answers

0
Harsh Kanakhara On

As mapping-key is deprecated in new Liferay Version I am getting my work done using mapping-table attribute