Uploaded image for project: 'PUBLIC - Liferay Portal Enterprise Edition'
  1. PUBLIC - Liferay Portal Enterprise Edition
  2. LPE-2401

ServiceBuilder generates wrong SQL for "primary key" in mapping-tables if "db-name" is used

    Details

      Description

      ServiceBuilder generates wrong SQL for "primary key" in mapping-tables if "db-name" is used. For example, given the following service.xml:

      <entity name="City" ...>
      <column name="cityId" type="long" primary="true" db-name="CITY_ID" />
      <column name="regionId" type="Collection" entity="Region" db-name="REGION_ID" mapping-table="MAPPING_TABLE" />
      </entity>
      <entity name="Region" ...>
      <column name="regionId" type="long" primary="true" db-name="REGION_ID" />
      <column name="cityId" type="Collection" entity="City" db-name="CITY_ID" mapping-table="MAPPING_TABLE"/>
      </entity>

      The resulting SQL is:

      create table MAPPING_TABLE (
      REGION_ID LONG not null,
      CITY_ID LONG not null,
      primary key (regionId, cityId)
      );

      The correct SQL is:

      create table MAPPING_TABLE (
      REGION_ID LONG not null,
      CITY_ID LONG not null,
      primary key (REGION_ID, CITY_ID)
      );

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pani.gui Pani Gui (Inactive)
                Reporter:
                brian.chan Brian Chan
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  5.1 EE SP6 (5.1.9)
                  5.2 EE SP4 (5.2.8)