All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.event.DeleteEvent Maven / Gradle / Ivy

There is a newer version: 3.6.0.Beta2
Show newest version
//$Id: DeleteEvent.java 7450 2005-07-11 20:33:59Z steveebersole $
package org.hibernate.event;


/** Defines an event class for the deletion of an entity.
 *
 * @author Steve Ebersole
 */
public class DeleteEvent extends AbstractEvent {

	private Object object;
	private String entityName;
	private boolean cascadeDeleteEnabled;

	/**
	 * Constructs a new DeleteEvent instance.
	 *
	 * @param object The entity to be deleted.
	 * @param source The session from which the delete event was generated.
	 */
	public DeleteEvent(Object object, EventSource source) {
		super(source);
		if (object == null) {
			throw new IllegalArgumentException(
					"attempt to create delete event with null entity"
				);
		}
		this.object = object;
	}

	public DeleteEvent(String entityName, Object object, EventSource source) {
		this(object, source);
		this.entityName = entityName;
	}

	public DeleteEvent(String entityName, Object object, boolean isCascadeDeleteEnabled, EventSource source) {
		this(object, source);
		this.entityName = entityName;
		cascadeDeleteEnabled = isCascadeDeleteEnabled;
	}

	/**
     * Returns the encapsulated entity to be deleed.
     *
     * @return The entity to be deleted.
     */
	public Object getObject() {
		return object;
	}

	public String getEntityName() {
		return entityName;
	}
	
	public boolean isCascadeDeleteEnabled() {
		return cascadeDeleteEnabled;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy