Field Unique Update with Hibernate

Asked

Viewed 75 times

0

How I treat a Unique field when it’s time to update with Hibernate.

It features duplicate field msg.

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '41987523699' for key 'UK_4yakf5drp3py7vaalfeb1mrv7'

1 answer

0

This is database constraint. Hibernate cannot treat this constraint. What you can do is remove the constraint (be careful with this option) or check if this restricted field already exists before an Insert or update

Browser other questions tagged

You are not signed in. Login or sign up in order to post.