// this will throw an error if there's something wrong.
try {
log.debugf( "Checking named SQL query: %s", namedSQLQueryDefinition.getName() );
// TODO : would be really nice to cache the spec on the query-def so as to not have to re-calc the hash;
// currently not doable though because of the resultset-ref stuff...
NativeSQLQuerySpecification spec;
if ( namedSQLQueryDefinition.getResultSetRef() != null ) {
ResultSetMappingDefinition definition = getResultSetMappingDefinition( namedSQLQueryDefinition.getResultSetRef() );
if ( definition == null ) {
throw new MappingException( "Unable to find resultset-ref definition: " + namedSQLQueryDefinition.getResultSetRef() );
}
spec = new NativeSQLQuerySpecification(
namedSQLQueryDefinition.getQueryString(),
definition.getQueryReturns(),
namedSQLQueryDefinition.getQuerySpaces()
);
}
else {
spec = new NativeSQLQuerySpecification(
namedSQLQueryDefinition.getQueryString(),
namedSQLQueryDefinition.getQueryReturns(),
namedSQLQueryDefinition.getQuerySpaces()
);
}