public ScrollableResults scroll( final QueryParameters queryParameters, final SessionImplementor session) throws HibernateException { HolderInstantiator hi = HolderInstantiator.createClassicHolderInstantiator( holderConstructor, queryParameters.getResultTransformer()); return scroll(queryParameters, returnTypes, hi, session); }
@Override protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException { // meant to handle dynamic instantiation queries...(Copy from QueryLoader) HolderInstantiator holderInstantiator = HolderInstantiator.getHolderInstantiator( null, resultTransformer, getReturnAliasesForTransformer()); if (holderInstantiator.isRequired()) { for (int i = 0; i < results.size(); i++) { Object[] row = (Object[]) results.get(i); Object result = holderInstantiator.instantiate(row); results.set(i, result); } return resultTransformer.transformList(results); } else { return results; } }
/** Return the query results as an iterator */ public Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException { boolean stats = session.getFactory().getStatistics().isStatisticsEnabled(); long startTime = 0; if (stats) startTime = System.currentTimeMillis(); try { final List<AfterLoadAction> afterLoadActions = new ArrayList<AfterLoadAction>(); final ResultSet rs = executeQueryStatement(queryParameters, false, afterLoadActions, session); final PreparedStatement st = (PreparedStatement) rs.getStatement(); HolderInstantiator hi = HolderInstantiator.createClassicHolderInstantiator( holderConstructor, queryParameters.getResultTransformer()); Iterator result = new IteratorImpl( rs, st, session, queryParameters.isReadOnly(session), returnTypes, getColumnNames(), hi); if (stats) { session .getFactory() .getStatisticsImplementor() .queryExecuted("HQL: " + queryString, 0, System.currentTimeMillis() - startTime); } return result; } catch (SQLException sqle) { throw getFactory() .getSQLExceptionHelper() .convert(sqle, "could not execute query using iterate", getSQLString()); } }
@Override protected ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer) { return HolderInstantiator.resolveResultTransformer(null, resultTransformer); }
@Override protected ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer) { return HolderInstantiator.resolveClassicResultTransformer(holderConstructor, resultTransformer); }