diff --git a/core/src/main/java/org/hibernate/action/EntityDeleteAction.java b/core/src/main/java/org/hibernate/action/EntityDeleteAction.java index e3a6e572db..56aa7c7fea 100644 --- a/core/src/main/java/org/hibernate/action/EntityDeleteAction.java +++ b/core/src/main/java/org/hibernate/action/EntityDeleteAction.java @@ -127,7 +127,7 @@ public final class EntityDeleteAction extends EntityAction { .getPreDeleteEventListeners(); boolean veto = false; if (preListeners.length>0) { - PreDeleteEvent preEvent = new PreDeleteEvent( getInstance(), getId(), state, getPersister() ); + PreDeleteEvent preEvent = new PreDeleteEvent( getInstance(), getId(), state, getPersister() ,(EventSource) getSession() ); for ( int i = 0; i < preListeners.length; i++ ) { veto = preListeners[i].onPreDelete(preEvent) || veto; } diff --git a/core/src/main/java/org/hibernate/action/EntityIdentityInsertAction.java b/core/src/main/java/org/hibernate/action/EntityIdentityInsertAction.java index 5d30248771..a1fb77fb1e 100644 --- a/core/src/main/java/org/hibernate/action/EntityIdentityInsertAction.java +++ b/core/src/main/java/org/hibernate/action/EntityIdentityInsertAction.java @@ -137,7 +137,7 @@ public final class EntityIdentityInsertAction extends EntityAction { .getPreInsertEventListeners(); boolean veto = false; if (preListeners.length>0) { - PreInsertEvent preEvent = new PreInsertEvent( getInstance(), null, state, getPersister(), getSession() ); + PreInsertEvent preEvent = new PreInsertEvent( getInstance(), null, state, getPersister(), (EventSource)getSession() ); for ( int i = 0; i < preListeners.length; i++ ) { veto = preListeners[i].onPreInsert(preEvent) || veto; } diff --git a/core/src/main/java/org/hibernate/action/EntityInsertAction.java b/core/src/main/java/org/hibernate/action/EntityInsertAction.java index 6bb064f759..095918918c 100644 --- a/core/src/main/java/org/hibernate/action/EntityInsertAction.java +++ b/core/src/main/java/org/hibernate/action/EntityInsertAction.java @@ -173,7 +173,7 @@ public final class EntityInsertAction extends EntityAction { .getPreInsertEventListeners(); boolean veto = false; if (preListeners.length>0) { - PreInsertEvent preEvent = new PreInsertEvent( getInstance(), getId(), state, getPersister(), getSession() ); + PreInsertEvent preEvent = new PreInsertEvent( getInstance(), getId(), state, getPersister(), (EventSource)getSession() ); for ( int i = 0; i < preListeners.length; i++ ) { veto = preListeners[i].onPreInsert(preEvent) || veto; } diff --git a/core/src/main/java/org/hibernate/action/EntityUpdateAction.java b/core/src/main/java/org/hibernate/action/EntityUpdateAction.java index 2eb3214419..177ddeba28 100644 --- a/core/src/main/java/org/hibernate/action/EntityUpdateAction.java +++ b/core/src/main/java/org/hibernate/action/EntityUpdateAction.java @@ -231,7 +231,7 @@ public final class EntityUpdateAction extends EntityAction { state, previousState, getPersister(), - getSession() + (EventSource)getSession() ); for ( int i = 0; i < preListeners.length; i++ ) { veto = preListeners[i].onPreUpdate(preEvent) || veto; diff --git a/core/src/main/java/org/hibernate/event/PreDeleteEvent.java b/core/src/main/java/org/hibernate/event/PreDeleteEvent.java index 7b2e7de33d..b750b7bad9 100755 --- a/core/src/main/java/org/hibernate/event/PreDeleteEvent.java +++ b/core/src/main/java/org/hibernate/event/PreDeleteEvent.java @@ -33,7 +33,7 @@ import org.hibernate.persister.entity.EntityPersister; * * @author Gavin King */ -public class PreDeleteEvent { +public class PreDeleteEvent extends AbstractEvent { private Object entity; private EntityPersister persister; private Serializable id; @@ -56,8 +56,10 @@ public class PreDeleteEvent { Object entity, Serializable id, Object[] deletedState, - EntityPersister persister + EntityPersister persister, + EventSource source ) { + super(source); this.entity = entity; this.persister = persister; this.id = id; diff --git a/core/src/main/java/org/hibernate/event/PreInsertEvent.java b/core/src/main/java/org/hibernate/event/PreInsertEvent.java index dc2abba6ca..d2a25c446b 100755 --- a/core/src/main/java/org/hibernate/event/PreInsertEvent.java +++ b/core/src/main/java/org/hibernate/event/PreInsertEvent.java @@ -27,28 +27,26 @@ package org.hibernate.event; import java.io.Serializable; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.engine.SessionImplementor; /** * Occurs before inserting an item in the datastore * * @author Gavin King */ -public class PreInsertEvent { +public class PreInsertEvent extends AbstractEvent { private Object entity; private EntityPersister persister; private Object[] state; private Serializable id; - private SessionImplementor source; public PreInsertEvent( Object entity, Serializable id, Object[] state, EntityPersister persister, - SessionImplementor source + EventSource source ) { - this.source = source; + super(source); this.entity = entity; this.id = id; this.state = state; @@ -67,7 +65,4 @@ public class PreInsertEvent { public Object[] getState() { return state; } - public SessionImplementor getSource() { - return source; - } } diff --git a/core/src/main/java/org/hibernate/event/PreUpdateEvent.java b/core/src/main/java/org/hibernate/event/PreUpdateEvent.java index 898111bf67..470a63ba27 100755 --- a/core/src/main/java/org/hibernate/event/PreUpdateEvent.java +++ b/core/src/main/java/org/hibernate/event/PreUpdateEvent.java @@ -27,20 +27,18 @@ package org.hibernate.event; import java.io.Serializable; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.engine.SessionImplementor; /** * Occurs before updating the datastore * * @author Gavin King */ -public class PreUpdateEvent { +public class PreUpdateEvent extends AbstractEvent { private Object entity; private EntityPersister persister; private Object[] state; private Object[] oldState; private Serializable id; - private SessionImplementor source; public PreUpdateEvent( Object entity, @@ -48,9 +46,9 @@ public class PreUpdateEvent { Object[] state, Object[] oldState, EntityPersister persister, - SessionImplementor source + EventSource source ) { - this.source = source; + super(source); this.entity = entity; this.id = id; this.state = state; @@ -73,7 +71,4 @@ public class PreUpdateEvent { public Object[] getState() { return state; } - public SessionImplementor getSource() { - return source; - } }