FileDocCategorySizeDatePackage
AbstractEntityLoader.javaAPI DocHibernate 3.2.52380Thu Mar 16 07:14:48 GMT 2006org.hibernate.loader.entity

AbstractEntityLoader

public abstract class AbstractEntityLoader extends org.hibernate.loader.OuterJoinLoader implements UniqueEntityLoader

Fields Summary
protected static final Log
log
protected final org.hibernate.persister.entity.OuterJoinLoadable
persister
protected final org.hibernate.type.Type
uniqueKeyType
protected final String
entityName
Constructors Summary
public AbstractEntityLoader(org.hibernate.persister.entity.OuterJoinLoadable persister, org.hibernate.type.Type uniqueKeyType, org.hibernate.engine.SessionFactoryImplementor factory, Map enabledFilters)


	 
			  
			  
			  
			  
		super( factory, enabledFilters );
		this.uniqueKeyType = uniqueKeyType;
		this.entityName = persister.getEntityName();
		this.persister = persister;
		
	
Methods Summary
protected java.lang.ObjectgetResultColumnOrRow(java.lang.Object[] row, org.hibernate.transform.ResultTransformer transformer, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)

		return row[row.length-1];
	
protected booleanisSingleRowLoader()

		return true;
	
public java.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, org.hibernate.engine.SessionImplementor session)

		return load(session, id, optionalObject, id);
	
protected java.lang.Objectload(org.hibernate.engine.SessionImplementor session, java.lang.Object id, java.lang.Object optionalObject, java.io.Serializable optionalId)

		
		List list = loadEntity(
				session, 
				id, 
				uniqueKeyType, 
				optionalObject, 
				entityName, 
				optionalId, 
				persister
			);
		
		if ( list.size()==1 ) {
			return list.get(0);
		}
		else if ( list.size()==0 ) {
			return null;
		}
		else {
			if ( getCollectionOwners()!=null ) {
				return list.get(0);
			}
			else {
				throw new HibernateException(
						"More than one row with the given identifier was found: " +
						id +
						", for class: " +
						persister.getEntityName()
					);
			}
		}