简体   繁体   English

集成器无法在Hibernate 5.x中正确加载

[英]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_INSERTEventType.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.

相关问题 Hibernate 5.x 中的自定义标量值函数 - Custom Scalar Valued function in Hibernate 5.x Hibernate 5.x迁移建议脚本 - Hibernate 5.x migration suggestions script 使用H2数据库的Junit 4.x + Hibernate 5.x. - Junit 4.x + Hibernate 5.x with H2 database Hibernate 5.x + Spring 5.x,无法自动装配DAOImpl类中的SessionFactory - Hibernate 5.x + Spring 5.x, can't autowire SessionFactory in DAOImpl class 在Hibernate 5.x中使用本机查询(更新查询)执行查询 - Execute query with native query (update query) in Hibernate 5.x 是否可以使用Hibernate Search 5.X对@Id字段使用数字编码 - Is it possible to use a numeric encoding for @Id fields with Hibernate Search 5.X Hibernate 5.x 中的 HQL 和 Criteria API 有什么区别? - What is difference between HQL and Criteria API in Hibernate 5.x? SessionImplementor是否可以访问Hibernate 5.x中的TransactionManager? - Does SessionImplementor have access to a TransactionManager in Hibernate 5.x? Hibernate从4.3.x迁移到5.x,用于方法org.hibernate.cfg.Configuration.getClassMapping(className) - Hibernate Migration from 4.3.x to 5.x for method org.hibernate.cfg.Configuration.getClassMapping(className) 多线程时 Hibernate 从 4.x 升级到 5.x 和 Spring 4.x 时出现 ConcurrentModificationException - ConcurrentModificationException when Hibernate Upgrade from 4.x to 5.x and Spring 4.x for Multi-Threaded
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM