Fórum

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

fdsd fsdfsdf, modificado 11 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 08/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

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

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Check the data type of the created table in the database.
fdsd fsdfsdf, modificado 11 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 08/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

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

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
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, modificado 11 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 08/02/12 Postagens Recentes
It seems to be solved after relaunch build-service, thanks you very much!
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

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

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
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, modificado 11 Anos atrás.

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

Junior Member Postagens: 79 Data de Entrada: 22/12/10 Postagens Recentes
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, modificado 11 Anos atrás.

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

Liferay Master Postagens: 679 Data de Entrada: 17/04/09 Postagens Recentes
Hi,

You can check Change in size of columns.

Hope this help.

Thanks,
Sagar Vyas