title: Hibernate Soft Deletion Still deleting my Record
body: <p>I'm trying to implement soft deletion using Hibernate but for some reason my record still gets deleted. Anyone mind taking a look.</p>
  
  <pre><code>public class SoftDeleteEventListener extends DefaultDeleteEventListener {
  
  private static final long serialVersionUID = 1L;
  
  @SuppressWarnings("rawtypes")
  @Override
  public void onDelete(DeleteEvent event, Set transientEntities) throws HibernateException {
      Object dbEntity = event.getObject();
  
      if (dbEntity instanceof Entity) 
      {
          ((Entity)dbEntity).setDeleted(true);
          ((Entity)dbEntity).setDeletedOn(new Date());
  
          EntityPersister persister = event.getSession().getEntityPersister( event.getEntityName(), dbEntity);
          EntityEntry entityEntry = event.getSession().getPersistenceContext().getEntry(dbEntity);
  
          cascadeBeforeDelete(event.getSession(), persister, dbEntity, entityEntry, transientEntities);
          cascadeAfterDelete(event.getSession(), persister, dbEntity, transientEntities);
      } else {
          super.onDelete(event, transientEntities);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this is how i am registering my session / listener</p>
  
  <pre><code>Configuration configuration = new Configuration();
          configuration.configure();
          StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
          sessionFactory = configuration.buildSessionFactory(ssrb.build());
  
          EventListenerRegistry registry = ((SessionFactoryImpl)sessionFactory).getServiceRegistry().getService(
          EventListenerRegistry.class);
          registry.getEventListenerGroup(EventType.DELETE).appendListener(new SoftDeleteEventListener());
  </code></pre>