如何为 Hibernate 中的插入、更新、删除等行更改添加监听器。
最佳答案
您可以使用 JPA 监听器 @PostUpdate
、@PostPersist
、@PostRemove
(这些可跨 ORM 框架移植),您可以查看 here对于 JPA 规范。
The PostPersist and postRemove callback methods are invoked for an entity after the entity has been made persistent or removed. These callbacks will also be invoked on all entities to which these operations are cascaded.
关于java - 如何在Hibernate中添加数据库更改的监听器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40488569/