title: How to return a custom message with @UniqueConstraint and @Column(unique = true)
body: <p>I would be capable to return a custom message when a user send a data that already existis in database.</p>
  <p>There is my class:</p>
  <pre><code>@Entity
  @Table(name=&quot;unity&quot;)
  @Data
  @Builder
  @AllArgsConstructor
  @NoArgsConstructor
  public class Unity {
  
      \\...
  
      @CNPJ(message = &quot;O CNPJ é inválido&quot;)
      @NotNull(message = &quot;Preencha o campo CNPJ&quot;)
      @Column(name=&quot;cnpj&quot;, unique = true )
      private String cnpj;
      
      \\...
      
  </code></pre>
  <p>I would like to sent a constraint error as the <code>@NotNull</code> anottation does, so i can grab it in the  <code>validator</code> within the controller.</p>
  <pre><code>    @POST
      @Override
      @Transactional
      public Response create(UnityDTO unityDTO){
          
          Set&lt;ConstraintViolation&lt;UnityDTO&gt;&gt; constraintViolations = validator.validate(unityDTO);
      
              if (constraintViolations.isEmpty()) {
                  UnityDTO unityDTOPersisted = unityMapper.unityToUnityDTO(unityService.save(unityDTO));
                  return Response
                          .fromResponse(
                                  createdResponse(unityDTOPersisted.getId(), UnityEndpoint.class)
                          ).entity(unityDTOPersisted).build();
              } else {
                  Set&lt;String&gt; errors = constraintViolations.stream().map(ConstraintViolation::getMessage).collect(Collectors.toSet());
                  return Response.status(Response.Status.BAD_REQUEST).entity(errors).build();
              }
  
  
              }
  
  </code></pre>
  <p>How can i do that?</p>