KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > ejb > callback > EJB3DeleteEventListener


1 //$Id: EJB3DeleteEventListener.java,v 1.1 2005/07/21 00:08:33 epbernard Exp $
2
package org.hibernate.ejb.callback;
3
4 import org.hibernate.event.def.DefaultDeleteEventListener;
5 import org.hibernate.event.EventSource;
6 import org.hibernate.persister.entity.EntityPersister;
7
8 /**
9  * Overrides the LifeCycle OnSave call to call the PreRemove operation
10  *
11  * @author Emmanuel Bernard
12  */

13 //TODO might be a predelete event but it would clash with the JACC events
14
public class EJB3DeleteEventListener extends DefaultDeleteEventListener {
15     private EntityCallbackHandler callbackHandler;
16
17     public EJB3DeleteEventListener(EntityCallbackHandler callbackHandler) {
18         super();
19         this.callbackHandler = callbackHandler;
20     }
21
22     @Override JavaDoc protected boolean invokeDeleteLifecycle(EventSource session, Object JavaDoc entity, EntityPersister persister) {
23         callbackHandler.preRemove( entity );
24         return super.invokeDeleteLifecycle( session, entity, persister );
25     }
26
27 }
28
Popular Tags