Spring Framework JpaSystemException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework JpaSystemException class.

This code example shows how to use the following methods:getMostSpecificCause
     */ 
    @ExceptionHandler(JpaSystemException.class) 
    @ResponseBody 
    @ResponseStatus(CONFLICT) 
    public String handleJpaSystemException(JpaSystemException e) { 
        return e.getMostSpecificCause().getMessage(); 
    } 
 
    /** 
     * This is for custom controllers (i.e. not spring-data-rest) that do validation. 
     * @param ex The {@link org.springframework.data.rest.core.RepositoryConstraintViolationException} thrown by the controller. 
     * @return A map of fieldnames to FieldErrors 
     */ 
    @ResponseBody 
    @ResponseStatus(BAD_REQUEST) 
    @ExceptionHandler(RepositoryConstraintViolationException.class) 
    public RepositoryConstraintViolationExceptionMessage handleRepositoryConstraintViolationException(RepositoryConstraintViolationException ex) { 
        return new RepositoryConstraintViolationExceptionMessage(ex, messageSourceAccessor); 
    } 
} 
4
CodeRank