FileDocCategorySizeDatePackage
DefaultUpdateEventListener.javaAPI DocHibernate 3.2.51701Mon Feb 21 20:09:36 GMT 2005org.hibernate.event.def

DefaultUpdateEventListener

public class DefaultUpdateEventListener extends DefaultSaveOrUpdateEventListener
An event handler for update() events
author
Gavin King

Fields Summary
Constructors Summary
Methods Summary
protected java.io.SerializablegetUpdateId(java.lang.Object entity, org.hibernate.persister.entity.EntityPersister persister, java.io.Serializable requestedId, org.hibernate.EntityMode entityMode)
If the user specified an id, assign it to the instance and use that, otherwise use the id already assigned to the instance


		if ( requestedId==null ) {
			return super.getUpdateId(entity, persister, requestedId, entityMode);
		}
		else {
			persister.setIdentifier(entity, requestedId, entityMode);
			return requestedId;
		}
	
protected java.io.SerializableperformSaveOrUpdate(org.hibernate.event.SaveOrUpdateEvent event)

		// this implementation is supposed to tolerate incorrect unsaved-value
		// mappings, for the purpose of backward-compatibility
		EntityEntry entry = event.getSession().getPersistenceContext().getEntry( event.getEntity() );
		if ( entry!=null ) {
			if ( entry.getStatus()==Status.DELETED ) {
				throw new ObjectDeletedException( "deleted instance passed to update()", null, event.getEntityName() );
			}
			else {
				return entityIsPersistent(event);
			}
		}
		else {
			entityIsDetached(event);
			return null;
		}