[英]When using JPA event listeners, is it possible to inject the actual event?
我知道有 Hibernate 方法可以创建这样的事件侦听器:
public class ActivityEventListener implements PostInsertEventListener {
@Override
public void onPostInsert(PostInsertEvent event) {
//do something
}
}
和 JPA 方式是这样的:
public class ActivityEventListener {
@PostPersist
public void onPostPersist(Object entity) {
//do something
}
}
我想用通用的 JPA 解决方案来 go 。 Is there some way in JPA to access the actual event (like the hibernate PostInsertEvent
) so as to access entity state information about old/current state, findDirty properties etc?
不,那是不可能的。 如果您需要详细信息,则必须使用 Hibernate 事件 model。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.