EntityPersister getIdentifier - 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 getIdentifier 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, getPropertyValues, getVersion, getVersionType, isVersioned
	} 
 
 
	// loading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 
	public Object get(Class entityClass, Serializable id) { 
		return get( entityClass.getName(), id ); 
	} 
 
	public Object get(Class entityClass, Serializable id, LockMode lockMode) { 
		return get( entityClass.getName(), id, lockMode ); 
	} 
 
	public Object get(String entityName, Serializable id) { 
		return get(entityName, id, LockMode.NONE); 
	} 
 
	public Object get(String entityName, Serializable id, LockMode lockMode) { 
		errorIfClosed(); 
		Object result = getFactory().getEntityPersister(entityName) 
5
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
This code example shows how to use the following methods:getEntityName, getIdentifier
This code example shows how to use the following methods:getEntityName, getIdentifier, getPropertyNames, getPropertyTypes, getPropertyValues
 
		if ( entityEntry == null ) { 
            LOG.trace("Entity was not persistent in delete processing"); 
 
			persister = source.getEntityPersister( event.getEntityName(), entity ); 
 
			if ( ForeignKeys.isTransient( persister.getEntityName(), entity, null, source ) ) { 
				deleteTransientEntity( source, entity, event.isCascadeDeleteEnabled(), persister, transientEntities ); 
				// EARLY EXIT!!! 
				return; 
			} 
            performDetachedEntityDeletionCheck(event); 
 
			id = persister.getIdentifier( entity, source ); 
 
			if ( id == null ) { 
				throw new TransientObjectException( 
						"the detached instance passed to delete() had a null identifier" 
				); 
			} 

4
CodeRank
This code example shows how to use the following methods:getIdentifier, getMappedClass
	 * Remove an entity entry from the session cache 
	 */ 
	public EntityEntry removeEntry(Object entity) { 
		return (EntityEntry) entityEntries.remove(entity); 
	} 
 
	/** 
	 * Is there an EntityEntry for this instance? 
	 */ 
	public boolean isEntryFor(Object entity) { 
		return entityEntries.containsKey(entity); 
	} 
 
	/** 
	 * Get the collection entry for a persistent collection 
	 */ 
	public CollectionEntry getCollectionEntry(PersistentCollection coll) { 
		return (CollectionEntry) collectionEntries.get(coll); 
	} 
 
2
CodeRank
getIdentifier Method Overview
Get the identifier of an instance (throw an exception if no identifier property)
See Code Examples for other Hibernate ORM EntityPersister Methods: