Methods Summary |
---|
protected void | autoDiscoverTypes(java.sql.ResultSet rs)
try {
Metadata metadata = new Metadata( getFactory(), rs );
List aliases = new ArrayList();
List types = new ArrayList();
rowProcessor.prepareForAutoDiscovery( metadata );
for ( int i = 0; i < rowProcessor.columnProcessors.length; i++ ) {
rowProcessor.columnProcessors[i].performDiscovery( metadata, types, aliases );
}
resultTypes = ArrayHelper.toTypeArray( types );
transformerAliases = ArrayHelper.toStringArray( aliases );
}
catch ( SQLException e ) {
throw new HibernateException( "Exception while trying to autodiscover types.", e );
}
|
private org.hibernate.persister.entity.Queryable | determineAppropriateOwnerPersister(NonScalarReturn ownerDescriptor)
String entityName = null;
if ( ownerDescriptor instanceof RootReturn ) {
entityName = ( ( RootReturn ) ownerDescriptor ).getEntityName();
}
else if ( ownerDescriptor instanceof CollectionReturn ) {
CollectionReturn collRtn = ( CollectionReturn ) ownerDescriptor;
String role = collRtn.getOwnerEntityName() + "." + collRtn.getOwnerProperty();
CollectionPersister persister = getFactory().getCollectionPersister( role );
EntityType ownerType = ( EntityType ) persister.getElementType();
entityName = ownerType.getAssociatedEntityName( getFactory() );
}
else if ( ownerDescriptor instanceof FetchReturn ) {
FetchReturn fetchRtn = ( FetchReturn ) ownerDescriptor;
Queryable persister = determineAppropriateOwnerPersister( fetchRtn.getOwner() );
Type ownerType = persister.getPropertyType( fetchRtn.getOwnerProperty() );
if ( ownerType.isEntityType() ) {
entityName = ( ( EntityType ) ownerType ).getAssociatedEntityName( getFactory() );
}
else if ( ownerType.isCollectionType() ) {
Type ownerCollectionElementType = ( ( CollectionType ) ownerType ).getElementType( getFactory() );
if ( ownerCollectionElementType.isEntityType() ) {
entityName = ( ( EntityType ) ownerCollectionElementType ).getAssociatedEntityName( getFactory() );
}
}
}
if ( entityName == null ) {
throw new HibernateException( "Could not determine fetch owner : " + ownerDescriptor );
}
return ( Queryable ) getFactory().getEntityPersister( entityName );
|
protected org.hibernate.loader.CollectionAliases[] | getCollectionAliases()
return collectionAliases;
|
protected int[] | getCollectionOwners()
return collectionOwners;
|
protected org.hibernate.persister.collection.CollectionPersister[] | getCollectionPersisters()
return collectionPersisters;
|
protected org.hibernate.loader.EntityAliases[] | getEntityAliases()
return entityAliases;
|
protected org.hibernate.persister.entity.Loadable[] | getEntityPersisters()
return entityPersisters;
|
private static org.hibernate.hql.HolderInstantiator | getHolderInstantiator(org.hibernate.transform.ResultTransformer resultTransformer, java.lang.String[] queryReturnAliases)
if ( resultTransformer != null ) {
return HolderInstantiator.NOOP_INSTANTIATOR;
}
else {
return new HolderInstantiator(resultTransformer, queryReturnAliases);
}
|
protected org.hibernate.LockMode[] | getLockModes(java.util.Map lockModesMap)
return lockModes;
|
public int[] | getNamedParameterLocs(java.lang.String name)
Object loc = namedParameterBindPoints.get( name );
if ( loc == null ) {
throw new QueryException(
"Named parameter does not appear in Query: " + name,
sql
);
}
if ( loc instanceof Integer ) {
return new int[] { ( ( Integer ) loc ).intValue() };
}
else {
return ArrayHelper.toIntArray( ( List ) loc );
}
|
protected int[] | getOwners()
return entiytOwners;
|
protected java.lang.String | getQueryIdentifier()
return sql;
|
public java.util.Set | getQuerySpaces()
return querySpaces;
|
protected java.lang.Object | getResultColumnOrRow(java.lang.Object[] row, org.hibernate.transform.ResultTransformer transformer, java.sql.ResultSet rs, org.hibernate.engine.SessionImplementor session)
return rowProcessor.buildResultRow( row, rs, transformer != null, session );
|
protected java.util.List | getResultList(java.util.List results, org.hibernate.transform.ResultTransformer resultTransformer)
// meant to handle dynamic instantiation queries...(Copy from QueryLoader)
HolderInstantiator holderInstantiator = HolderInstantiator.getHolderInstantiator(
null,
resultTransformer,
getReturnAliasesForTransformer()
);
if ( holderInstantiator.isRequired() ) {
for ( int i = 0; i < results.size(); i++ ) {
Object[] row = ( Object[] ) results.get( i );
Object result = holderInstantiator.instantiate(row);
results.set( i, result );
}
return resultTransformer.transformList(results);
}
else {
return results;
}
|
private java.lang.String[] | getReturnAliasesForTransformer()
return transformerAliases;
|
protected java.lang.String | getSQLString()
return sql;
|
public java.util.List | list(org.hibernate.engine.SessionImplementor session, org.hibernate.engine.QueryParameters queryParameters)
return list( session, queryParameters, querySpaces, resultTypes );
|
public org.hibernate.ScrollableResults | scroll(org.hibernate.engine.QueryParameters queryParameters, org.hibernate.engine.SessionImplementor session)
return scroll(
queryParameters,
resultTypes,
getHolderInstantiator( queryParameters.getResultTransformer(), getReturnAliasesForTransformer() ),
session
);
|