Message Boards

serviceBuilder convert-null not working, empty string becomes null

Erik Lillegraven, modified 5 Years ago.

serviceBuilder convert-null not working, empty string becomes null

Junior Member Posts: 27 Join Date: 6/6/11 Recent Posts
Hello everyone,

I got a problem in service builder with saving objects with empty strings '' that becomes null when saved to postgres database v9.6.
According to DTD, convert-null is true by default, and I have not modified this in service.xml.
​​​​​​​Using Liferay CE 7.1 GA3.
No problem with this in Liferay v6.2, which always saved as empty string ''.

This may become problematic if the column is used in a unique index. since null is not considered equal, and therefore opens up for duplicates.

I could not found any other threads about this problem.
What can possible be causing this?

Thanks,
Erik
thumbnail
David H Nebinger, modified 5 Years ago.

RE: serviceBuilder convert-null not working, empty string becomes null

Liferay Legend Posts: 14915 Join Date: 9/2/06 Recent Posts
So change convert null to false?
Erik Lillegraven, modified 5 Years ago.

RE: serviceBuilder convert-null not working, empty string becomes null

Junior Member Posts: 27 Join Date: 6/6/11 Recent Posts
I tried setting it to both false and true, but it makes no difference.
I think maybe that this functionality is done by Hibernate, but don't know how this parameter/flag is sent from serviceBuilder code to Hibernate?

Thanks,
​​​​​​​Erik