JsfExceptionHandler ConstraintViolationImp messageTemplate

Asked

Viewed 24 times

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.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.