How can I configure hibernate event listeners "post-insert", "post-delete", "post-load", "post-update" in java configuration? Either thru annotations or using Spring IOC? Also, is there a开发者_运维知识库 way to configure for a specific entity rather than in the method checking instanceof?
You can use the JPA annotations @PostLoad, @PostPersist, @PostRemove, @PostUpdate, @PrePersist, @PreRemove, @PreUpdate in void methods without parameters inside your entity class. They will be called when the event is performed for a specific entity.
http://download.oracle.com/javaee/5/api/index.html?javax/persistence/package-summary.html
精彩评论