Don't validate if field if null


I am using hibernate validation to validate a brazillian number for companies, called CNPJ

	@Column(nullable = true, length = 18, unique = true)
	private String cnpj;

But in my form this field is not required.

But and I try to save a register with CNPJ field null, I got a NotValidException.

How do I not validate if this field is null ?


Are you sure the exception is coming from Hibernate Validator? Because we do accept null values: .

I think so…

And out front-end is sending CNPJ field with “”, and not “null”. I think this is the problem…

Now I am trying to send “null” instead “”