As suggested by Sanne Grinovero, we should use JPA's EntityExistsException to indicate the insertion of an entity with a duplicate id. Currently that's only the case if the first entity still exists in the current persistence context, whereas otherwise a plain HibernateException will be raised.
|