CollectionElementLoaderpublic class CollectionElementLoader extends org.hibernate.loader.OuterJoinLoader
Fields Summary |
---|
private static final Log | log | private final org.hibernate.persister.entity.OuterJoinLoadable | persister | private final org.hibernate.type.Type | keyType | private final org.hibernate.type.Type | indexType | private final String | entityName |
Constructors Summary |
---|
public CollectionElementLoader(org.hibernate.persister.collection.QueryableCollection collectionPersister, org.hibernate.engine.SessionFactoryImplementor factory, Map enabledFilters)
super(factory, enabledFilters);
this.keyType = collectionPersister.getKeyType();
this.indexType = collectionPersister.getIndexType();
this.persister = (OuterJoinLoadable) collectionPersister.getElementPersister();
this.entityName = persister.getEntityName();
JoinWalker walker = new EntityJoinWalker(
persister,
ArrayHelper.join(
collectionPersister.getKeyColumnNames(),
collectionPersister.getIndexColumnNames()
),
1,
LockMode.NONE,
factory,
enabledFilters
);
initFromWalker( walker );
postInstantiate();
log.debug( "Static select for entity " + entityName + ": " + getSQLString() );
|
Methods Summary |
---|
protected java.lang.Object | getResultColumnOrRow(java.lang.Object[] row, org.hibernate.transform.ResultTransformer transformer, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
return row[row.length-1];
| protected boolean | isSingleRowLoader()
return true;
| public java.lang.Object | loadElement(org.hibernate.engine.SessionImplementor session, java.lang.Object key, java.lang.Object index)
List list = loadEntity(
session,
key,
index,
keyType,
indexType,
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 was found");
}
}
|
|