Hibernate Interceptor - after load event(休眠拦截器 - 加载事件之后)
问题描述
加载实体后是否发生任何事件?我的目标是将此实体添加到 Solr 或 Lucene 索引.EmptyInterceptor OnLoad 事件在对象初始化之前发生.我想在设置对象属性后处理一个事件.是否可以使用 Hibernate 拦截器或其他东西?
Is there any event that occurs after an entity is loaded? My goal is to add this entity to a Solr or Lucene index. The EmptyInterceptor OnLoad event occurs BEFORE an object is initialized. I want to handle an event AFTER the object properties are set. Is it possible with Hibernate Interceptors or with something else?
推荐答案
@PostLoad
似乎可以完成这项工作(请参阅 社区文档).如果您在实体中使用 this 注释方法,则应在加载实体后触发.
@PostLoad
seems to do the job (see community documentation). If you annotate a method with this inside your entity, it should be triggered after the entity has been loaded.
这篇关于休眠拦截器 - 加载事件之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:休眠拦截器 - 加载事件之后


基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 降序排序:Java Map 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01