Problem with Hibernate Event Listener
by Tope Faro
Hi all,
I am trying to configure Hibernate Event Listener in a Spring-Hibernate
project. Spring (3.2.3), Hibernate(4.2.1.Final).
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.
Kindly advise on how best to go about this.
@Component
@Log4j
public class TicketHibernateEventListener implements
SaveOrUpdateEventListener, PostLoadEventListener {
@Inject
VoucherService voucherService;
@Override
public void onSaveOrUpdate(SaveOrUpdateEvent evt) throws
HibernateException {
log.debug(">>>>>>>onSaveOrUpdate by: " + evt.getEntityName());
}
@Override
public void onPostLoad(PostLoadEvent evt) {
log.debug(">>>>>>>onPostLoad by: " + evt.getEntity());
}
}
10 years, 4 months