4

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?

rghome
  • 8,529
  • 8
  • 43
  • 62
DraggonZ
  • 1,057
  • 1
  • 16
  • 22
  • My simple one file example of hibernate listeners for spring boot (spring-boot-starter 1.2.4.RELEASE) http://stackoverflow.com/a/31725844/975169 – Enginer Jul 30 '15 at 14:33

1 Answers1

5

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

Magnilex
  • 11,584
  • 9
  • 62
  • 84
  • I don't have access to entities classes (they are in core, my code is in a module). Sorry, I didn't mention this. – DraggonZ Jul 05 '13 at 11:05
  • @DraggonZ Maybe you should edit your question with this? As your question is now, my answer is valid. If you edit your question, I will delete this answer. – Magnilex Aug 19 '13 at 12:41