Hibernate ORM SaveOrUpdateEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM SaveOrUpdateEvent class.

This code example shows how to use the following methods:getEntity, getEntityName, getRequestedId, getSession
			return entityIsTransient(event);
		} 
	} 
	 
	protected Serializable saveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) {
		if ( event.getRequestedId() == null ) {
			return super.saveWithGeneratedOrRequestedId(event);
		} 
		else { 
			return saveWithRequestedId(  
					event.getEntity(), 
					event.getRequestedId(), 
					event.getEntityName(), 
					null,  
					event.getSession() 
				); 
		} 
		 
	} 
 
6
CodeRank
This code example shows how to use the following methods:getEntity, getSession
public class DefaultUpdateEventListener extends DefaultSaveOrUpdateEventListener {
 
	protected Serializable performSaveOrUpdate(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; 
		} 
	} 
	 
	/** 
6
CodeRank