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

ServiceBuilder doesn't support one-to-one relationships out of the box

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Inactive
    • Affects Version/s: 6.0.3 GA, 6.0.5 GA, 6.0.6 GA, 6.2.0 CE M4
    • Fix Version/s: None
    • Environment:
      Using Liferay 6.03 with tomcat 6.0.26 bundle. IDE is Eclipse Galileo with Liferay IDE. Liferay plugins SDK 6.0.3. SO Linux, Fedora 13. JDK is java-1.6.0, openjdk-1.6.0.0-41.b18
    • Fix Priority:
      3

      Description

      Service builder doesn't work as expected when trying to generate a one-to-one relation between two entities defined in the same service.xml file. Consider the next service.xml snip:

      <entity name="Producto" table="productos">
      <column name="id" type="int" primary="true"></column>
      </entity>
      <entity name="Formato" table="formatos">
      <column name="id" type="int" primary="true"></column>
      <column name="producto" type="Producto" entity="Producto" mapping-key="idProducto"></column>
      </entity>
      Then generation fails with the following output:

      [java] Error on line 68, column 33 in com/liferay/portal/tools/servicebuilder/dependencies/model_impl.ftl
      [java] serviceBuilder.getSqlType(packagePath + ".model." + entity.getName(), column.getName(), column.getType()) is undefined.
      [java] It cannot be assigned to sqlType
      [java] The problematic instruction:
      [java] ----------
      [java] ==> assignment: sqlType=serviceBuilder.getSqlType(packagePath + ".model." + entity.getName(), column.getName(), column.getType()) [on line 68, column 33 in com/liferay/portal/tools/servicebuilder/dependencies/model_impl.ftl]
      [java] ----------
      [java] Java backtrace for programmers:
      [java] ----------
      [java] freemarker.core.InvalidReferenceException: Error on line 68, column 33 in com/liferay/portal/tools/servicebuilder/dependencies/model_impl.ftl
      [java] serviceBuilder.getSqlType(packagePath + ".model." + entity.getName(), column.getName(), column.getType()) is undefined.
      [java] It cannot be assigned to sqlType
      [java] at freemarker.core.Assignment.accept(Assignment.java:111)

      The expected behaviour should be having a generated method like getProducto().

      I suspect this can't also be done between entities in different services: http://www.liferay.com/web/guest/community/forums/-/message_boards/message/480294#_19_message_782016, but haven't tried nor found a ticket about this forum post.

        Attachments

          Activity

            People

            • Votes:
              30 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 32 weeks, 3 days ago