public BackendCustomQuery(NativeSQLQuerySpecification spec, SessionFactoryImplementor factory) throws HibernateException {
LOG.tracev( "Starting processing of NoSQL query [{0}]", spec.getQueryString() );
this.spec = spec;
SQLQueryReturnProcessor processor = new SQLQueryReturnProcessor(spec.getQueryReturns(), factory);
processor.process();
customQueryReturns = Collections.unmodifiableList( processor.generateCustomReturns( false ) );
if ( spec.getQuerySpaces() != null ) {
@SuppressWarnings("unchecked")
Set<String> spaces = spec.getQuerySpaces();
querySpaces = Collections.<String>unmodifiableSet( spaces );