Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liferay Service Builder - Column of type Collection (List<String>)

I am newbie to Liferay. I would like to build with Service Builder the following column for the entity Traveller:

<entity name="Traveller" local-service="true" remote-service="true">
 <column name="citiesList" type="Collection"></column>
</entity>

When I run the service Builder, in the class TravellerModel.java the corresponding get/set methods are not generated.

I have tried the following solution without success:

<column name="citiesList" type="Collection" entity="java.lang.String"></column>

Can someone tell me how I can define a list of Strings (List) in Liferay Service Builder?

Thanks in advance.

like image 861
julianfperez Avatar asked Jan 31 '26 05:01

julianfperez


1 Answers

(Closing an old thread..) List is not a field you can simply create on Service builder by declaring it, as the rational is the same you would probably use when thinking about a DB schema, you would normally create an auxiliary table with foreign keys and values, or embed the data in a single data field to be encoded (not great).

On SB, though, you can using mapping tables or an extra entity to reformulate your list representation. Besides that you can add Lists as a parameter on you LocalServiceImpl class that consumes or build lists in a higher level.

like image 58
Victor Avatar answered Feb 01 '26 19:02

Victor