[hibernate-users] Problem with Hibernate Event Listener
Tope Faro
topriddy at gmail.com
Sun Aug 3 12:05:58 EDT 2014
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());
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-users/attachments/20140803/c0cd158f/attachment.html
More information about the hibernate-users
mailing list