问题
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