FileDocCategorySizeDatePackage
SubselectFetch.javaAPI DocHibernate 3.2.52032Fri Jul 29 00:36:14 BST 2005org.hibernate.engine

SubselectFetch

public class SubselectFetch extends Object
author
Gavin King

Fields Summary
private final Set
resultingEntityKeys
private final String
queryString
private final String
alias
private final org.hibernate.persister.entity.Loadable
loadable
private final QueryParameters
queryParameters
private final Map
namedParameterLocMap
Constructors Summary
public SubselectFetch(String alias, org.hibernate.persister.entity.Loadable loadable, QueryParameters queryParameters, Set resultingEntityKeys, Map namedParameterLocMap)

		this.resultingEntityKeys = resultingEntityKeys;
		this.queryParameters = queryParameters;
		this.namedParameterLocMap = namedParameterLocMap;
		this.loadable = loadable;
		this.alias = alias;
		
		//TODO: ugly here:
		final String queryString = queryParameters.getFilteredSQL();
		int fromIndex = queryString.indexOf(" from ");
		int orderByIndex = queryString.lastIndexOf("order by");
		this.queryString = orderByIndex>0 ? 
				queryString.substring(fromIndex, orderByIndex) : 
				queryString.substring(fromIndex);
			
	
Methods Summary
public java.util.MapgetNamedParameterLocMap()

		return namedParameterLocMap;
	
public QueryParametersgetQueryParameters()

		return queryParameters;
	
public java.util.SetgetResult()
Get the Set of EntityKeys

		return resultingEntityKeys;
	
public java.lang.StringtoString()

		return "SubselectFetch(" + queryString + ')";
	
public java.lang.StringtoSubselectString(java.lang.String ukname)

		
		String[] joinColumns = ukname==null ?
			StringHelper.qualify( alias, loadable.getIdentifierColumnNames() ) :
			( (PropertyMapping) loadable ).toColumns(alias, ukname);
		
		return new StringBuffer()
			.append("select ")
			.append( StringHelper.join(", ", joinColumns) )
			.append(queryString)
			.toString();