休眠拦截器-加载事件后 [英] Hibernate Interceptor - after load event

查看:92
本文介绍了休眠拦截器-加载事件后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

加载实体后是否发生任何事件? 我的目标是将此实体添加到Solr或Lucene索引中.在初始化对象之前,EmptyInterceptor OnLoad事件发生.我想在设置对象属性后处理一个事件.休眠拦截器或其他工具有可能吗?

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似乎起到了作用(请参阅

@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.

这篇关于休眠拦截器-加载事件后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆