<div dir="ltr">Hi all,<div><br></div><div>I am trying to configure Hibernate Event Listener in a Spring-Hibernate project. Spring (3.2.3), Hibernate(4.2.1.Final).</div><div><br></div><div>The problem I am having is that I have SaveOrUpdate and PreUpdate events triggered when I load an entity. This is causing issues for me as I cannot differentiate between a user read event and a save/update event.</div>
<div><br></div><div>Kindly advise on how best to go about this.</div><div><br></div><div><br></div><div><div>@Component</div><div>@Log4j</div><div>public class TicketHibernateEventListener implements SaveOrUpdateEventListener, PostLoadEventListener {</div>
<div><br></div><div> @Inject</div><div> VoucherService voucherService;</div><div><br></div><div> @Override</div><div> public void onSaveOrUpdate(SaveOrUpdateEvent evt) throws HibernateException {</div><div> log.debug(">>>>>>>onSaveOrUpdate by: " + evt.getEntityName());</div>
<div> }</div><div><br></div><div> @Override</div><div> public void onPostLoad(PostLoadEvent evt) {</div><div> log.debug(">>>>>>>onPostLoad by: " + evt.getEntity());</div><div>
}</div><div>}</div></div></div>