As noted by crizzis, the best option is likely modeling the join table as an @Entity
, defining the desired behavior in its @PreUpdate
and @PrePersist
, and the refactoring the relationship on both sides to be @OneToMany
with the new class instead of using @JoinTable
.