[英]Integrator not properly loading in Hibernate 5.x
I'm working with Hibernate 5 in a web project, and I need to listen to some database events such as updates and deletes. 我正在一个Web项目中使用Hibernate 5,我需要听一些数据库事件,例如更新和删除。
I'm trying to use the event structure from Hibernate, and I need to use an Integrator to add my listeners. 我正在尝试使用Hibernate中的事件结构,并且需要使用Integrator来添加我的侦听器。 The problem is, the way most guides are using to do it (creating a file META-INF/services/org.hibernate.integrator.spi.Integrator with the full name of my Integrator class) is not working for me at all.
问题是,大多数指南使用它的方式(创建具有我的Integrator类全名的文件META-INF / services / org.hibernate.integrator.spi.Integrator)对我来说根本不起作用。 I've tried debugging the ClassLoaderService, and my integrator is just ignored.
我已经尝试调试ClassLoaderService,而我的集成器只是被忽略。
Has anyone gone to this issue? 有人去过这个问题吗?
Thank you 谢谢
I had a similar problem, while using the EventListenerRegistry
with a custom Integrator approach of intercepting events: http://docs.jboss.org/hibernate/orm/5.1/userguide/html_single/Hibernate_User_Guide.html#events-events . 在将
EventListenerRegistry
与用于拦截事件的自定义Integrator方法结合使用时,我遇到了类似的问题: http : //docs.jboss.org/hibernate/orm/5.1/userguide/html_single/Hibernate_User_Guide.html#events-events 。
I couldn't get my events (eg EventType.PRE_INSERT
, EventType.PRE_UPDATE
) to work when I called session.save(entity)
or session.update(entity)
. 当我调用
session.save(entity)
或session.update(entity)
时,我的事件(例如EventType.PRE_INSERT
, EventType.PRE_UPDATE
)无法正常工作。
When I switched to EventType.PERSIST
and used session.persist(entity)
, things started working. 当我切换到
EventType.PERSIST
并使用session.persist(entity)
,事情开始起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.