Examples of RowSelection


Examples of org.hibernate.engine.RowSelection

 
  public QueryKey(String queryString, QueryParameters queryParameters, Set filters, EntityMode entityMode) {
    this.sqlQueryString = queryString;
    this.types = queryParameters.getPositionalParameterTypes();
    this.values = queryParameters.getPositionalParameterValues();
    RowSelection selection = queryParameters.getRowSelection();
    if (selection!=null) {
      firstRow = selection.getFirstRow();
      maxRows = selection.getMaxRows();
    }
    else {
      firstRow = null;
      maxRows = null;
    }
View Full Code Here

Examples of org.hibernate.engine.RowSelection

      }
    }
    Object[] valueArray = values.toArray();
    Type[] typeArray = ArrayHelper.toTypeArray( types );

    RowSelection selection = new RowSelection();
    selection.setFirstRow( rootCriteria.getFirstResult() );
    selection.setMaxRows( rootCriteria.getMaxResults() );
    selection.setTimeout( rootCriteria.getTimeout() );
    selection.setFetchSize( rootCriteria.getFetchSize() );

    Map lockModes = new HashMap();
    iter = rootCriteria.getLockModes().entrySet().iterator();
    while ( iter.hasNext() ) {
      Map.Entry me = ( Map.Entry ) iter.next();
View Full Code Here

Examples of org.hibernate.engine.RowSelection

  public int execute(QueryParameters parameters, SessionImplementor session) throws HibernateException {

    coordinateSharedCacheCleanup( session );

    PreparedStatement st = null;
    RowSelection selection = parameters.getRowSelection();

    try {
      try {
        st = session.getBatcher().prepareStatement( sql );
        Iterator parameterSpecifications = this.parameterSpecifications.iterator();
        int pos = 1;
        while ( parameterSpecifications.hasNext() ) {
          final ParameterSpecification paramSpec = ( ParameterSpecification ) parameterSpecifications.next();
          pos += paramSpec.bind( st, parameters, session, pos );
        }
        if ( selection != null ) {
          if ( selection.getTimeout() != null ) {
            st.setQueryTimeout( selection.getTimeout().intValue() );
          }
        }

        return st.executeUpdate();
      }
View Full Code Here

Examples of org.hibernate.engine.RowSelection

    boolean needsDistincting = ( query.getSelectClause().isDistinct() || hasLimit ) && containsCollectionFetches();

    QueryParameters queryParametersToUse;
    if ( hasLimit && containsCollectionFetches() ) {
      log.warn( "firstResult/maxResults specified with collection fetch; applying in memory!" );
      RowSelection selection = new RowSelection();
      selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() );
      selection.setTimeout( queryParameters.getRowSelection().getTimeout() );
      queryParametersToUse = queryParameters.createCopyUsing( selection );
    }
    else {
      queryParametersToUse = queryParameters;
    }
View Full Code Here

Examples of org.hibernate.engine.spi.RowSelection

      final SessionImplementor session,
      final QueryParameters queryParameters,
      final boolean returnProxies,
      final ResultTransformer forcedResultTransformer) throws SQLException, HibernateException {

    final RowSelection selection = queryParameters.getRowSelection();
    final int maxRows = LimitHelper.hasMaxRows( selection ) ?
        selection.getMaxRows() :
        Integer.MAX_VALUE;

    final List<AfterLoadAction> afterLoadActions = new ArrayList<AfterLoadAction>();

    final SqlStatementWrapper wrapper = executeQueryStatement( queryParameters, false, afterLoadActions, session );
View Full Code Here

Examples of org.hibernate.engine.spi.RowSelection

          final QueryParameters queryParameters,
          final LimitHandler limitHandler,
          final boolean scroll,
          final SessionImplementor session) throws SQLException, HibernateException {
    final Dialect dialect = getFactory().getDialect();
    final RowSelection selection = queryParameters.getRowSelection();
    boolean useLimit = LimitHelper.useLimit( limitHandler, selection );
    boolean hasFirstRow = LimitHelper.hasFirstRow( selection );
    boolean useLimitOffset = hasFirstRow && useLimit && limitHandler.supportsLimitOffset();
    boolean callable = queryParameters.isCallable();
    final ScrollMode scrollMode = getScrollMode( scroll, hasFirstRow, useLimitOffset, queryParameters );

    PreparedStatement st = session.getTransactionCoordinator().getJdbcCoordinator().getStatementPreparer().prepareQueryStatement(
        sql,
        callable,
        scrollMode
    );

    try {

      int col = 1;
      //TODO: can we limit stored procedures ?!
      col += limitHandler.bindLimitParametersAtStartOfQuery( st, col );

      if (callable) {
        col = dialect.registerResultSetOutParameter( (CallableStatement)st, col );
      }

      col += bindParameterValues( st, queryParameters, col, session );

      col += limitHandler.bindLimitParametersAtEndOfQuery( st, col );

      limitHandler.setMaxRows( st );

      if ( selection != null ) {
        if ( selection.getTimeout() != null ) {
          st.setQueryTimeout( selection.getTimeout() );
        }
        if ( selection.getFetchSize() != null ) {
          st.setFetchSize( selection.getFetchSize() );
        }
      }

      // handle lock timeout...
      LockOptions lockOptions = queryParameters.getLockOptions();
View Full Code Here

Examples of org.hibernate.engine.spi.RowSelection

                       queryParameters.getRowSelection().definesLimits();
    boolean needsLimit = hasLimit && translators.length > 1;
    QueryParameters queryParametersToUse;
    if ( needsLimit ) {
      LOG.needsLimit();
      RowSelection selection = new RowSelection();
      selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() );
      selection.setTimeout( queryParameters.getRowSelection().getTimeout() );
      queryParametersToUse = queryParameters.createCopyUsing( selection );
    }
    else {
      queryParametersToUse = queryParameters;
    }
View Full Code Here

Examples of org.hibernate.engine.spi.RowSelection

      List<AfterLoadAction> afterLoadActionList) throws SQLException {

    handlePotentiallyEmptyCollectionRootReturns( loadPlan, queryParameters.getCollectionKeys(), resultSet, session );

    final int maxRows;
    final RowSelection selection = queryParameters.getRowSelection();
    if ( LimitHelper.hasMaxRows( selection ) ) {
      maxRows = selection.getMaxRows();
      LOG.tracef( "Limiting ResultSet processing to just %s rows", maxRows );
    }
    else {
      maxRows = Integer.MAX_VALUE;
    }
View Full Code Here

Examples of org.hibernate.engine.spi.RowSelection

  public CriteriaImpl getRootCriteria() {
    return rootCriteria;
  }

  public QueryParameters getQueryParameters() {
    final RowSelection selection = new RowSelection();
    selection.setFirstRow( rootCriteria.getFirstResult() );
    selection.setMaxRows( rootCriteria.getMaxResults() );
    selection.setTimeout( rootCriteria.getTimeout() );
    selection.setFetchSize( rootCriteria.getFetchSize() );

    final LockOptions lockOptions = new LockOptions();
    final Map<String, LockMode> lockModeMap = rootCriteria.getLockModes();
    for ( final String key : lockModeMap.keySet() ) {
      final Criteria subcriteria = getAliasedCriteria( key );
View Full Code Here

Examples of org.hibernate.engine.spi.RowSelection

      LOG.debug( "Done batch load" );

    }

    private void doTheLoad(String sql, QueryParameters queryParameters, SessionImplementor session) throws SQLException {
      final RowSelection selection = queryParameters.getRowSelection();
      final int maxRows = LimitHelper.hasMaxRows( selection ) ?
          selection.getMaxRows() :
          Integer.MAX_VALUE;

      final List<AfterLoadAction> afterLoadActions = Collections.emptyList();
      final SqlStatementWrapper wrapper = executeQueryStatement( sql, queryParameters, false, afterLoadActions, session );
      final ResultSet rs = wrapper.getResultSet();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.