1 Reply Latest reply on Dec 1, 2009 11:31 PM by Aejaz Muslim

    Hibernate PostDelete event listener not getting called

    Aejaz Muslim Newbie

      Hi,

      I have the following class in my jar file(which has all the EJBs)
      which gets deployed on JBoss 5.0 AS.

      public class MyClass implements PostDeleteEventListener,
      PostInsertEventListener, PostUpdateEventListener, Initializable {


      public void onPostDelete(PostDeleteEvent event) {
      System.out.println("Post delete event received");
      }

      public void onPostInsert(final PostInsertEvent event) {
      System.out.println("Post insert event received");
      }

      public void onPostUpdate(final PostUpdateEvent event) {
      System.out.println("Post update event received");
      }

      public void initialize(final Configuration config) {
      }

      }

      I have the following entries in my persistence.xml,

      property name="hibernate.ejb.event.post-insert" value="org.hibernate.ejb.event.EJB3PostInsertEventListener, "services.util.MyClass"
      property name="hibernate.ejb.event.post-update"
      value="org.hibernate.ejb.event.EJB3PostUpdateEventListener, services.util.MyClass"
      property name="hibernate.ejb.event.post-delete"
      value="org.hibernate.ejb.event.EJB3PostDeleteEventListener, services.util.MyClass"

      When I execute an update or insert HQL statement, corresponding
      methods onPostUpdate() & onPostInsert() are being called but if
      I execute a delete statement the corresponding onPostDelete()
      method is not getting called.

      Does anyone have any idea why this will not work.

      Thanks,
      Aejaz