4
I have an application using Primefaces/JPA-Hibernate/Tomcat8, and I need that when a field on the screen is empty, it will record null
in the bank (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 save an empty string in the database -> ''
I’m already using the parameter: javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
and it doesn’t seem to work. I already used Convert to nullify the empty String, and also in the works, because when the value reaches my entity the string is empty again and not null. Missing some lib or no how to do this I really want?
default null
in the columns? Entity Listener?PrePersist
and/orPreUpdate
in the entity(s) you need?– Bruno César
I made a test using the wildfly and parameter javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is obeyed! It would be a problem of tomcat8 then?
– Odione
When climbing the Tomcat, include this section in the
JVM_OPTION
:-Dorg.apache.el.parser.COERCE_TO_ZERO=false
. See if it works, it should only affect number, but I remember having problems with it in one version of it.– Bruno César
I forgot to mention that I was already using this COERCE_TO_ZERO=false option and it also did not have an effect.
– Odione