Unique Update Field with Hibernate

0

How do I treat a unique field when doing an update with hibernate.

It displays the duplicate field msg.

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '41987523699' for key 'UK_4yakf5drp3py7vaalfeb1mrv7'
    
asked by anonymous 30.06.2017 / 14:37

1 answer

0

This is database restriction. Hibernate can not handle this restriction. What you can do is remove the restriction (be careful with this option) or check if this restricted field already exists before an insert or update

    
30.06.2017 / 16:20