service.xml customize database columns type

In my service.xml, I have a field in entity named extraData, the values could be very large.

<entity name="Tweet" local-service="true" remote-service="false">
<column name="twitterScreenName" type="String" />
<column name="extraData" type="String"></column>

...more

By default, the two columns in tables will be varchar(75). It's not enough for extraData. At the same time, I don't want to change database manually. Fortunately, we have solutions.

In your project, you can find portlet-model-hints.xml in your src/META-INF folder, we just need to change the file. Like this:

<field name="extraData" type="String">
<hint-collection name="TEXTAREA" />
</field>

Then, we rebuild our project, in the database, you'll see the type of the column will be LONGTEXT.


For more information, check the link: http://www.liferay.com/community/wiki/-/wiki/Main/Customize+DB+Column+Sizes

你可能感兴趣的:(column,service,type,database,builder,liferay,service.xml)