Hibernate Interceptor - after load event

╄→гoц情女王★ 提交于 2019-12-12 15:56:13

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/17487134/hibernate-interceptor-after-load-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!