// $Id: NativeSQLQueryNonScalarReturn.java 7232 2005-06-19 17:16:40 -0500 (Sun, 19 Jun 2005) maxcsaucdk $
package org.hibernate.engine.query.sql;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
/**
* Represents the base information for a non-scalar return defined as part of
* a native sql query.
*
* @author Steve Ebersole
*/
public abstract class NativeSQLQueryNonScalarReturn implements NativeSQLQueryReturn, Serializable {
private final String alias;
private final LockMode lockMode;
private final Map propertyResults = new HashMap();
/**
* Constructs some form of non-scalar return descriptor
*
* @param alias The result alias
* @param propertyResults Any user-supplied column->property mappings
* @param lockMode The lock mode to apply to the return.
*/
protected NativeSQLQueryNonScalarReturn(String alias, Map propertyResults, LockMode lockMode) {
this.alias = alias;
if ( alias == null ) {
throw new HibernateException("alias must be specified");
}
this.lockMode = lockMode;
if ( propertyResults != null ) {
this.propertyResults.putAll( propertyResults );
}
}
/**
* Retrieve the defined result alias
*
* @return The result alias.
*/
public String getAlias() {
return alias;
}
/**
* Retrieve the lock-mode to apply to this return
*
* @return The lock mode
*/
public LockMode getLockMode() {
return lockMode;
}
/**
* Retrieve the user-supplied column->property mappings.
*
* @return The property mappings.
*/
public Map getPropertyResultsMap() {
return Collections.unmodifiableMap( propertyResults );
}
}
|