Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-3472

ServiceBuilder generates wrong SQL for "primary key" in mapping-tables, if using db-name

    Details

    • Branch Version/s:
      5.2.x, 5.1.x
    • Backported to Branch:
      Committed
    • Liferay Contributor's Agreement:
      Accept

      Description

      SZENARIO:

      • Using service.xml with mapping-table and db-name:
        <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>

      IS:

      • Resulting SQL for the mapping table:
        create table MAPPING_TABLE (
        REGION_ID LONG not null,
        CITY_ID LONG not null,
        primary key (regionId, cityId)
        );
      • Definition "primary key (regionId, cityId)" is wrong because "db-name" attribute in service.xml is used
      • Code: svn://svn.liferay.com/repos/public/portal/tags/5.2.3/portal-impl/src/com/liferay/portal/tools/servicebuilder/ServiceBuilder.java:3592
        String colName = col.getName();

      SHOULD:

      • Code: svn://svn.liferay.com/repos/public/portal/tags/5.2.3/portal-impl/src/com/liferay/portal/tools/servicebuilder/ServiceBuilder.java:3592
        String colName = col.getDBName();
      • Resulting SQL script should look like: "primary key (REGION_ID, CITY_ID)"

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                support-lep@liferay.com SE Support
                Reporter:
                jvolgmann Jens Meinecke
                Participants of an Issue:
                Recent user:
                Esther Sanz
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  10 years, 11 weeks, 6 days ago

                  Packages

                  Version Package
                  6.0.1 RC