掲示板

Data too long when saving content from liferay-ui:input-editor

11年前 に fdsd fsdfsdf によって更新されました。

Data too long when saving content from liferay-ui:input-editor

New Member 投稿: 6 参加年月日: 12/02/08 最新の投稿
Hi all, I'm new in Liferay and I am trying to develop a new portlet, similar to blogs. I have a form with the liferay-ui:input-editor component to introduce long text with html format.
When I submit the form, I get an error if the text entered in the input-editor is a bit long:

[JDBCExceptionReporter:76] Data truncation: Data too long for column 'content' at row 1

I have defined in service.xml the column content as follow: <column name="content" type="String" />. I guess that the database cant store long text in this column, but I can see in service.xml from blogs portlet the same definition for the column content: <column name="content" type="String" />. So, I dont know how to store large text in the database without get the error "Data too long".

I'm using MySQL (UTF-8) and the type of the column "content" is longtext. I have also defined a hint <field name="content" type="String"><hint name="max-length">2000000</hint></field> in the file portlet-model-hints.xml but the problem is still there

Someone can help me? Thanks very much (And sorry for my bad english).
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Check the data type of the created table in the database.
11年前 に fdsd fsdfsdf によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

New Member 投稿: 6 参加年月日: 12/02/08 最新の投稿
The data type is 'longtext'. I have done a insert query directly to the database with a long text and I can store it without problems, so I dont know why liferay is not able to do it.
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
If the database table column size is correct, check if there is a maxsize specified in the input field in the html tag or the css class. To test, explicitly insert a maxsize attribute in the input field to see if the value goes through.

BTW, did you recreate the services after changing hints because it's working for me.
11年前 に Victor Pineda によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

New Member 投稿: 6 参加年月日: 12/02/08 最新の投稿
It seems to be solved after relaunch build-service, thanks you very much!
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Good to hear that you got it working. It's necessary to rebuild service (ant build-service) after making modification to scheme definition and interface definition.
thumbnail
11年前 に Mathieu Hicauber によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

Junior Member 投稿: 79 参加年月日: 10/12/22 最新の投稿
Hitoshi Ozawa:
If the database table column size is correct, check if there is a maxsize specified in the input field in the html tag or the css class. To test, explicitly insert a maxsize attribute in the input field to see if the value goes through.

BTW, did you recreate the services after changing hints because it's working for me.


Hi,

Got the same problem here.
I made a custom model hints file, ext-model-hints.xml, and added it to an ext plugin.

I thought that would be enough, I don't get the build-services step : whar service.xml file are we talking about ?

Thank you very much.

Mathieu.
thumbnail
11年前 に Sagar A Vyas によって更新されました。

RE: Data too long when saving content from liferay-ui:input-editor

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
Hi,

You can check Change in size of columns.

Hope this help.

Thanks,
Sagar Vyas