This is the Code
Person.java
@Entity
class Person {
@Id private Long Id;
@NotNull private String name;
//getter setters
}
PersonRepository.java
@RepositoryRestResource(collectionResourceRel = "person", path="person" )
interface PersonRepository extends CrudRepository<Person,Long>{
}
Now, when I send null against name attribute , the validator validates it correctly, but the actual exception that is getting thrown is TransactionRollbackExecption.
Like this
{
"timestamp": "2018-03-14T09:01:08.533+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Error while committing the transaction",
"path": "/peron"
}
How do I get the actual ConstraintViolation exception. I do see the exception in logs. But its not getting thrown.