开发者

Hibernate event listener java configuration

开发者 https://www.devze.com 2023-02-03 23:02 出处:网络
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开发者

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

0

精彩评论

暂无评论...
验证码 换一张
取 消