FileDocCategorySizeDatePackage
NativeSQLQuerySpecification.javaAPI DocHibernate 3.2.52162Thu Jun 15 00:21:06 BST 2006org.hibernate.engine.query.sql

NativeSQLQuerySpecification

public class NativeSQLQuerySpecification extends Object
Defines the specification or blue-print for a native-sql query. Essentially a simple struct containing the information needed to "translate" a native-sql query and cache that translated representation. Also used as the key by which the native-sql query plans are cached.
author
Steve Ebersole

Fields Summary
private final String
queryString
private final NativeSQLQueryReturn[]
queryReturns
private final Set
querySpaces
private final int
hashCode
Constructors Summary
public NativeSQLQuerySpecification(String queryString, NativeSQLQueryReturn[] queryReturns, Collection querySpaces)

		this.queryString = queryString;
		this.queryReturns = queryReturns;
		if ( querySpaces == null ) {
			this.querySpaces = Collections.EMPTY_SET;
		}
		else {
			Set tmp = new HashSet();
			tmp.addAll( querySpaces );
			this.querySpaces = Collections.unmodifiableSet( tmp );
		}

		// pre-determine and cache the hashcode
		int hashCode = queryString.hashCode();
		hashCode = 29 * hashCode + this.querySpaces.hashCode();
		if ( this.queryReturns != null ) {
			hashCode = 29 * hashCode + ArrayHelper.toList( this.queryReturns ).hashCode();
		}
		this.hashCode = hashCode;
	
Methods Summary
public booleanequals(java.lang.Object o)

		if ( this == o ) {
			return true;
		}
		if ( o == null || getClass() != o.getClass() ) {
			return false;
		}

		final NativeSQLQuerySpecification that = ( NativeSQLQuerySpecification ) o;

		return querySpaces.equals( that.querySpaces ) &&
		       queryString.equals( that.queryString ) &&
		       Arrays.equals( queryReturns, that.queryReturns );
	
public NativeSQLQueryReturn[]getQueryReturns()

		return queryReturns;
	
public java.util.SetgetQuerySpaces()

		return querySpaces;
	
public java.lang.StringgetQueryString()

		return queryString;
	
public inthashCode()

		return hashCode;