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

Service Builder fails to compile when it has a compound key and "co." prefix in package-path

Details

    • 3
    • Windows 10
    • Oracle Sun JDK 8
    • Apache Tomcat 9.0.x

    Description

      Steps to Reproduce:

      1. Create a service builder module.
      2. Add a compound primary key
      <?xml version="1.0"?>
      <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 7.3.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_7_3_0.dtd">
      <service-builder dependency-injector="ds" package-path="co.com.test.portal.sb">
      	<namespace>TestPackage</namespace>
      	<entity local-service="true" name="TestEntity" remote-service="true" uuid="true">
      		<column name="name" primary="true" db-name="Name" type="long" />
      		<column name="lastName" primary="true" db-name="lastName" type="long" />
      		<column name="other" db-name="Other" type="String" />
      	</entity>
      </service-builder>
      
      1. Execute buildService and deploy gradle tasks's.

      Expected Results
      The service compiles successfully.

      Current Results:
      The service fails to compile with errors regarding the composite key and "co." package.

      Sample Error Message:

      > Task :modules:test-b-sb:test-b-sb-api:compileJava> Task :modules:test-b-sb:test-b-sb-api:compileJava \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityPersistence.java:169: error: cannot find symbol co.TestEntityPK testEntityPK, String uuid,   ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityPersistence.java:209: error: cannot find symbol public TestEntity create(co.TestEntityPK testEntityPK);                            ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityPersistence.java:218: error: cannot find symbol public TestEntity remove(co.TestEntityPK testEntityPK)                            ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityPersistence.java:230: error: cannot find symbol public TestEntity findByPrimaryKey(co.TestEntityPK testEntityPK)                                      ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityPersistence.java:239: error: cannot find symbol public TestEntity fetchByPrimaryKey(co.TestEntityPK testEntityPK);                                       ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityUtil.java:262: error: cannot find symbol co.TestEntityPK testEntityPK, String uuid,   ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityUtil.java:313: error: cannot find symbol public static TestEntity create(co.TestEntityPK testEntityPK) {                                   ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityUtil.java:324: error: cannot find symbol public static TestEntity remove(co.TestEntityPK testEntityPK)                                   ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityUtil.java:341: error: cannot find symbol public static TestEntity findByPrimaryKey(co.TestEntityPK testEntityPK)                                             ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityUtil.java:353: error: cannot find symbol public static TestEntity fetchByPrimaryKey(co.TestEntityPK testEntityPK) {                                              ^  symbol:   class TestEntityPK  location: package co \liferay-ws-7.3\liferay-ws-7.3\modules\test-b-sb\test-b-sb-api\src\main\java\co\com\test\portal\sb\service\persistence\TestEntityPersistence.java:218: error: remove(TestEntityPK) in TestEntityPersistence clashes with remove(T) in BasePersistence public TestEntity remove(co.TestEntityPK testEntityPK)                   ^  overridden method does not throw NoSuchTestEntityException  where T is a type-variable:    T extends BaseModel<T> declared in interface BasePersistence11 errors > Task :modules:test-b-sb:test-b-sb-api:compileJava FAILED FAILURE: Build failed with an exception. * What went wrong:Execution failed for task ':modules:test-b-sb:test-b-sb-api:compileJava'.> Compilation failed; see the compiler error output for details. * Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 6s1 actionable task: 1 executed

      Additional hints:

      • At TestEntityUtil.java the primary key is generated this way:
      public static TestEntity[] findByUuid_PrevAndNext(
      			co.TestEntityPK testEntityPK, String uuid,
      			...
      	}

      And it should be generated like this:

      public static TestEntity[] findByUuid_PrevAndNext(
      	co.com.test.portal.sb.service.persistence.TestEntityPK testEntityPK, 
      			...
      	}

       

       

       

      Attachments

        Activity

          People

            support-lep@liferay.com SE Support
            TheoG Laura Prada
            Summer Zhang Summer Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              21 weeks, 6 days ago

              Packages

                Version Package