1
I have the mapping in the user class:
@NotNull(message = "Contato não pode ser vázio.")
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "contact_id")
@Getter
@Setter
private Contato contato;
Which I have the class JsfExceptionHandler
that captures all exceptions of the application. I performed the processing for errors of constraint violations
, but I need to display only the validation message and not all the error text as is happening.
Message that is being displayed:
Validation failed for classes
[br.com.openfiscal.model.Usuario] during persist time for groups
[javax.validation.groups.Default, ]
List of constraint violations:
[ ConstraintViolationImpl{interpolatedMessage='Contato não pode ser vázio.',
propertyPath=contato, rootBeanClass=class br.com.openfiscal.model.Usuario,
messageTemplate='Contato não pode ser vázio.'} ]
I wish to display only the messageTemplate
.