ConstraintViolationException

I have a project that works with Hibernate 4.3, I plan to upgrade the project to Hibernate 5.2. I implemented specific businesses in many parts of the code by catching ConstraintViolationException. The important thing for me is that in version 4.3 the errors that lead to ConstraintVoliationException, are all those errors in version 5 thrown with ConstraintViolationException? Or did these errors change to another type of exception, such as persisitenceException?
And in general, I want to know if from version 4.3 to 5.2 we have a special difference in throwing the exception type?

Indeed, in Hibernate 5 the implementation was adapted to align with what the JPA specification demands. The Hibernate specific ConstraintViolationException is now wrapped in a PersistenceException when Hibernate is booted up in JPA mode. There is still a native mode though. Look into the migration guides: https://github.com/hibernate/hibernate-orm/wiki/Migration-Guides

if I do not use jpa mode and use native mode, Is there again a change in the type of error?

I don’t think so, but why don’t you try it out and see for yourself?