EntityPersister isTransient - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for EntityPersister isTransient method.

This code example shows how to use the following methods:getIdentifier, isTransient

6
CodeRank
This code example shows how to use the following methods:getIdentifier, isTransient
	throws HibernateException {
		if ( object == null ) { 
			return null; 
		} 
		else { 
			Serializable id = session.getContextEntityIdentifier( object );
			if ( id == null ) {
				// context-entity-identifier returns null explicitly if the entity 
				// is not associated with the persistence context; so make some 
				// deeper checks... 
				if ( isTransient(entityName, object, Boolean.FALSE, session) ) {
					throw new TransientObjectException(
							"object references an unsaved transient instance - save the transient instance before flushing: " + 
							(entityName == null ? session.guessEntityName( object ) : entityName)
					); 
				} 
				id = session.getEntityPersister( entityName, object ).getIdentifier( object, session );
			} 
			return id;
		} 

6
CodeRank
This code example shows how to use the following methods:getIdentifier, isTransient
 
		if ( isNotEmbedded( session ) ) { 
			return id; 
		} 
		 
		if ( id == null ) { 
			return null; 
		} 
		else { 
			return resolveIdentifier( id, session ); 
		} 
	} 
 
	private Serializable assembleId(Serializable oid, SessionImplementor session) { 
		//the owner of the association is not the owner of the id 
		return ( Serializable ) getIdentifierType( session ).assemble( oid, session, null ); 
	} 
 
	public void beforeAssemble(Serializable oid, SessionImplementor session) { 
		scheduleBatchLoadIfNeeded( assembleId( oid, session ), session ); 

6
CodeRank
This code example shows how to use the following methods:getIdentifier, isTransient
	 * Two entities are considered the same when their instances are the same. 
	 * 
	 * 
	 * @param x One entity instance 
	 * @param y Another entity instance 
	 * @return True if x == y; false otherwise. 
	 */ 
	public final boolean isSame(Object x, Object y) { 
		return x == y; 
	} 
 
	/** 
	 * {@inheritDoc} 
	 */ 
	public int compare(Object x, Object y) { 
		return 0; //TODO: entities CAN be compared, by PK, fix this! -> only if/when we can extract the id values.... 
	} 
 
	/** 
	 * {@inheritDoc} 

5
CodeRank
isTransient Method Overview
Is this a new transient instance?
See Code Examples for other Hibernate ORM EntityPersister Methods: