I got several entities. Two of them got a many-to-many relation. When I do a bigger operation on these entities it fails with this exception:
org.hibernate.exception.ConstraintViolationException: could not insert collection rows:
I execute the operation i a @Transactional context. I don't do any explicit flushing i my daos. The flush is triggered by a query. In the queue are 15 elements (all of the same structure). one of them always fails (but it's always a different one (I checked) and always at a different position).
Does anybody have a hint for me for what I might do wrong?
My Mapping:
@ManyToMany(targetEntity = CategoryImpl.class)
protected Set<Category> categories = new HashSet<Category>();