DefaultUpdateEventListenerpublic class DefaultUpdateEventListener extends DefaultSaveOrUpdateEventListener An event handler for update() events |
Methods Summary |
---|
protected java.io.Serializable | getUpdateId(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.Serializable | performSaveOrUpdate(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;
}
|
|