Foren

LR7 and SB convert-null

pleo84 84, geändert vor 6 Jahren.

LR7 and SB convert-null

New Member Beiträge: 18 Beitrittsdatum: 26.03.17 Neueste Beiträge
Hi everybody,
i've a foreign key (int) and i want to save it as null by service builder when not initialized (0-value).

In service.xml i use
<column name="idFK" type="int" db-name="CCLI_IDFK" convert-null="false"></column>

but i receive a "Cannot add or update a child row: a foreign key constraint fails" on the CCLI_IDFK field (is a mysql nullable field).

the "convert-null" property is active in LR7? alternatives? i've try also with true but it doesn't go.

For the moment i disabled the foreign key but isn't a great solution emoticon

Thank you to everybody!
thumbnail
Andrew Jardine, geändert vor 6 Jahren.

RE: LR7 and SB convert-null

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi pleo84,

I checked the DTD from the source, and it looks like it is still supported in 7. I can see in the DTD a comment explaining a bit about it as well --

The convert-null value specifies whether or not the column value is
automatically converted to a non null value if it is null. This only applies if
the type value is String. This is particularly useful if your entity is
referencing a read only table or a database view so that Hibernate does not try
to issue unnecessary updates. The default value is true.


-- are you experiencing and error when you run the "build-service" target/task? A runtime error? or ... it's just not doing what you expect?
pleo84 84, geändert vor 6 Jahren.

RE: LR7 and SB convert-null

New Member Beiträge: 18 Beitrittsdatum: 26.03.17 Neueste Beiträge
Hi Andrew,
many thanks for yout support and sorry for the delay.
You're right: i applied the features to int field but, as you said, the feature work only for String field.
I resolved using String in table and with some dirty code for manage it.


Many thanks again and happy coding! emoticon