List of usage examples for org.hibernate.event.spi DeleteEvent getSession
public final EventSource getSession()
From source file:org.granite.tide.hibernate4.HibernateDeleteListener.java
License:Open Source License
@Override public void onDelete(DeleteEvent event) throws HibernateException { try {// w ww . j a va 2s.c om super.onDelete(event); } catch (StaleObjectStateException e) { HibernateOptimisticLockException.rethrowOptimisticLockException(event.getSession(), e); } }
From source file:org.granite.tide.hibernate4.HibernateDeleteListener.java
License:Open Source License
@SuppressWarnings("rawtypes") @Override/*from w ww. j a v a 2s.c om*/ public void onDelete(DeleteEvent event, Set transientEntities) throws HibernateException { try { super.onDelete(event, transientEntities); } catch (StaleObjectStateException e) { HibernateOptimisticLockException.rethrowOptimisticLockException(event.getSession(), e); } }
From source file:org.openeos.hibernate.internal.observers.DAOListenerManager.java
License:Apache License
@SuppressWarnings("unchecked") private void fireDeleteEvent(DeleteEvent event, boolean before) { org.openeos.dao.DeleteEvent<Object> ourEvent = new org.openeos.dao.DeleteEvent<Object>(event.getSession(), event.getObject());//from w w w. j a va2s . c o m try { for (DeleteListener<Object> listener : getListenerByObject(DeleteListener.class, event.getObject())) { LOG.debug("Calling DeleteListener"); if (before) { listener.beforeDelete(ourEvent); } else { listener.afterDelete(ourEvent); } } } catch (UserException ex) { // TODO throw new HibernateException(ex); } }