I used to use Hibernate 4 before, now I use Hibernate 5.2.17, in the new Hibernate ConstraintViolationException is converted to PersistenceException, which is done in ExceptionConverterImpl class, this is not my favorite topic. What can I do to prevent my Exception type from converting to PersistenceExcpetion?
I need to say
I do not use JPA and I use Hibernate Native
Since you see PersistenceException
, you are probably bootstrapping Hibernate through the JPA API. If you bootstrap Hibernate through the Hibernate native API, you will see the old behavior. Also see here for a more in-depth discussion about this: Hibernate ORM 5.4.28.Final User Guide