Foren

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

fdsd fsdfsdf, geändert vor 11 Jahren.

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

New Member Beiträge: 6 Beitrittsdatum: 08.02.12 Neueste Beiträge
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
Hitoshi Ozawa, geändert vor 11 Jahren.

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

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Check the data type of the created table in the database.
fdsd fsdfsdf, geändert vor 11 Jahren.

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

New Member Beiträge: 6 Beitrittsdatum: 08.02.12 Neueste Beiträge
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
Hitoshi Ozawa, geändert vor 11 Jahren.

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

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
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.
Victor Pineda, geändert vor 11 Jahren.

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

New Member Beiträge: 6 Beitrittsdatum: 08.02.12 Neueste Beiträge
It seems to be solved after relaunch build-service, thanks you very much!
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

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

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
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
Mathieu Hicauber, geändert vor 11 Jahren.

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

Junior Member Beiträge: 79 Beitrittsdatum: 22.12.10 Neueste Beiträge
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
Sagar A Vyas, geändert vor 11 Jahren.

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

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
Hi,

You can check Change in size of columns.

Hope this help.

Thanks,
Sagar Vyas