Foros de discusión

Long and Integer problem with null in db in liferay 6.2 EE

Koffi AGHOSTO, modificado hace 8 años.

Long and Integer problem with null in db in liferay 6.2 EE

Junior Member Mensajes: 67 Fecha de incorporación: 27/05/14 Mensajes recientes
Hello everybody,

I have a serious problem with Liferay 6.2 EE SP 11 precisely with service builder. I want to insert nullable value in DB
in Long column. So I define in service.xml :

<column name="accidentId" type="Long" convert-null="false" />

But, when I tried to insert null in db, Liferay service builder not insert null but zero (0). I tried anything to solve this problem by
added convert-null, same result, it is not working. (This forum : https://www.liferay.com/fr/community/forums/-/message_boards/message/6811878)

My question : How can I solve this problem?

My environment : Liferay 6.2 EE SP11 MySQL

Any help will welcomed,
Thank you in advanced
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Long and Integer problem with null in db in liferay 6.2 EE

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
The object counterparts for the primitives are not supported, only the primitives are.

You either have to hack up SB to support the object wrappers or you could just treat 0 as null.
Koffi AGHOSTO, modificado hace 8 años.

RE: Long and Integer problem with null in db in liferay 6.2 EE

Junior Member Mensajes: 67 Fecha de incorporación: 27/05/14 Mensajes recientes
Hello David,

Thank you for your reply. I need to insert null value because my column "accidentId" is an Foreign Key which must be
nullable. I get constraint error from Mysql when Service builder tries to insert zero(0) because there are no field with primary key 0 in
the reference table.

I want to ask you please, how can I hack up SB to support the object wrappers? As you can see in this forum, https://www.liferay.com/fr/community/forums/-/message_boards/message/6811878, the author preconizes to add 'convert-null' but it is not working.

Thank you in advanced,
Bests regards,
Koffi
Enrique Vallés, modificado hace 7 años.

RE: Long and Integer problem with null in db in liferay 6.2 EE

New Member Mensajes: 24 Fecha de incorporación: 13/10/10 Mensajes recientes
Hello Koffi,

I have the same problem in Liferay 6.2 EE. Please, how have you solved the ploblem?

Thank you!