Spring Data REST - difference between @PrePersist and @HandleBeforeCreate?
I use Spring Data Rest over JPA mappings. JPA provides @PrePersist annotation for methods to be called before the persistence of en entity in the DB. Spring Data Rest provides @HandleBeforeCreate annotation for method to be called when catching an entity creation event. This seems rather equivalent to me. When should I use one and when should I use the other ? @HandleBeforeCreate is only called when a REST request comes in but @PrePersist is called during the entities lifecycles. So, if your call path is not through the REST (for instance by calling the entity manager directly or due to the