开发者

Hibernate event listener java configuration

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜