In one of my concurrent insert operation in the same table I'm getting the ConstraintViolationException.
javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException:
could not insert:
Can Hibernate Optimistic Lock can help me in this regard? As far I know that Optimistic locking work in update/delete operation on same record in the database.
Does it work for insert query as well?
I have created a version column in the target table (entity). But still getting the same exception(no optimisticLockException or StaleObjectStateException).