liferay-7liferay-service-builder

Liferay 7.0 service builder: how to properly reference entity from another module


I'm new to liferay, trying some simple form creation.

First I created Dictionaries module with several dictionaries. They are all similar: TBL_NAME {id, description}. It worked well, tables within DB was created.

Then I created second module (service builder type) and tried to reference some fields to that dictionaries (one-to-many).

But I keep getting "Unable to find X in Y" error on build.

They are both in the same package-path. I tried to put them into the same namespace, added dictionary project to build path, even added

compileOnly project(":modules:dictionary:dictionary-api")
compileOnly project(":modules:dictionary:dictionary-service")

to build.gradle.

<service-builder package-path="my.path">
    <namespace>TN</namespace>

    <entity name="Tblname" local-service="true" table="_TBLNAME">
        <column name="city" type="Collection" entity="my.path.City"></column>       

        <!-- References -->
        <reference package-path="my.path" entity="City" />

What I'm doing wrong?

Also - should they both have the same namespace ("TN")?


Solution

  • The modules should have a different namespace and most importantly different package. Otherwise, you run into split bundle scenario.