JSF / Hibernate How do I write null to a bank field?

5

I have an application using Primefaces / JPA-Hibernate / TomCat8, and need that when an on-screen field is empty, it writes null to the database (Postgres). I need this because I have some fields in the database that have UniqueKey, and even when the field is empty on the screen, and writes an empty string in the database - > ''

I'm already using the parameter: javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL and it seems to have no effect. I have already used Convert to make the empty String empty, and also in the function, because when the value reaches my entity the string is empty again and not null. Is it missing some lib or not how to do this that I really want?

    
asked by anonymous 07.11.2015 / 17:31

1 answer

0

Places the default value null in the field of your entity!

private String valor = null;
    
01.12.2015 / 15:40