We have a @PrePersist listener We also have an entity with @ElementCollection Set<String> When we call entityManager.merge(entity), the collections that we see in the @PrePersist listener are empty. I checked the code of DefaultMergeEventListener and it seems it copies the values in two goes, and invokes the user-defined listeners between the two.
It works properly if we invoke .persist()
This is unexpected behaviour (as nowhere in the documentation it is specified that an incomplete entity may be receiged in @PrePersist)
|