There are multiple places in the code that pertain to deletion, which try to catch exception of type org.hibernate.exception.ConstraintViolationException. Although this exception gets thrown, it is wrapped by Hibernate into javax.persistence.PersistenceException, and so no org.hibernate.exception.ConstraintViolationException can be caught in practice.
The implementation of deletion needs to be inspected and adjusted to actually catch exceptions due to violations of DB constraints, so that these can be reported to users in a friendly manner.
Expected outcome
More reliable handling of DB constraint violations, providing a more user-friendly message in case of such violations when users try to delete some entities.
Description
There are multiple places in the code that pertain to deletion, which try to catch exception of type
org.hibernate.exception.ConstraintViolationException
. Although this exception gets thrown, it is wrapped by Hibernate intojavax.persistence.PersistenceException
, and so noorg.hibernate.exception.ConstraintViolationException
can be caught in practice.The implementation of deletion needs to be inspected and adjusted to actually catch exceptions due to violations of DB constraints, so that these can be reported to users in a friendly manner.
Expected outcome
More reliable handling of DB constraint violations, providing a more user-friendly message in case of such violations when users try to delete some entities.