docs: public ResultSetAndStatement executeQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException
      {
          if (logger.isDebugEnabled())
          {
              logger.debug("executeQuery: " + query);
          }
          /*
  		 * MBAIRD: we should create a scrollable resultset if the start at
  		 * index or end at index is set
  		 */
          boolean scrollable = ((query.getStartAtIndex() > Query.NO_START_AT_INDEX) || (query.getEndAtIndex() > Query.NO_END_AT_INDEX));
          /*
  		 * OR if the prefetching of relationships is being used.
  		 */
          if (query != null && query.getPrefetchedRelationships() != null && !query.getPrefetchedRelationships().isEmpty())
          {
              scrollable = true;
          }
          final StatementManagerIF sm = broker.serviceStatementManager();
          final SelectStatement sql = broker.serviceSqlGenerator().getPreparedSelectStatement(query, cld);
          PreparedStatement stmt = null;
          ResultSet rs = null;
          try
          {
              final int queryFetchSize = query.getFetchSize();
              final boolean isStoredProcedure = isStoredProcedure(sql.getStatement());
              stmt = sm.getPreparedStatement(cld, sql.getStatement() ,
                      scrollable, queryFetchSize, isStoredProcedure);
              if (isStoredProcedure)
              {
                  // Query implemented as a stored procedure, which must return a result set.
                  // Query sytax is: { ?= call PROCEDURE_NAME(?,...,?)}
                  getPlatform().registerOutResultSet((CallableStatement) stmt, 1);
                  sm.bindStatement(stmt, query, cld, 2);
  
                  if (logger.isDebugEnabled())
                      logger.debug("executeQuery: " + stmt);
  
                  stmt.execute();
                  rs = (ResultSet) ((CallableStatement) stmt).getObject(1);
              }
              else
              {
                  sm.bindStatement(stmt, query, cld, 1);
  
                  if (logger.isDebugEnabled())
                      logger.debug("executeQuery: " + stmt);
  
                  rs = stmt.executeQuery();
              }
  
              return new ResultSetAndStatement(sm, stmt, rs, sql);
          }
          catch (PersistenceBrokerException e)
          {
              // release resources on exception
              sm.closeResources(stmt, rs);
              logger.error("PersistenceBrokerException during the execution of the query: " + e.getMessage(), e);
              throw e;
          }
          catch (SQLException e)
          {
              // release resources on exception
              sm.closeResources(stmt, rs);
              throw ExceptionHelper.generateException(e, sql.getStatement(), null, logger, null);
          }
      }