Monday 7 November 2011

JPA/Hibernate: @PrePersist, @PreUpdate, @PostLoad don't work!

If using Hibernate:

  • if using the Session API: @PrePersist, @PreUpdate wont't work (see 1)
    [solution(see 2): register an event listener to hibernate events]
  • if using the EntityManager API: @PrePersist, @PreUpdate will work

 

If using pure JPA: @PrePersist, @PreUpdate work fine!

 

References
(1),
(2)

No comments:

Post a Comment