Package org.hibernate.engine.spi

Examples of org.hibernate.engine.spi.QueryParameters


  public Object[] valueArray() {
    return getValues().toArray();
  }

  public QueryParameters getQueryParameters(Map namedParams) {
    QueryParameters queryParameters = new QueryParameters(
        typeArray(),
        valueArray(),
        namedParams,
        getLockOptions(),
        getRowSelection(),
        true,
        isReadOnly(),
        cacheable,
        cacheRegion,
        comment,
        queryHints,
        collectionKey == null ? null : new Serializable[] { collectionKey },
        optionalObject,
        optionalEntityName,
        optionalId,
        resultTransformer
    );
    queryParameters.setQueryPlan( queryPlan );
    return queryParameters;
  }
View Full Code Here


    selection.setFetchSize( fetchSize );
    return this;
  }

  public QueryParameters buildQueryParametersObject() {
    QueryParameters qp = new QueryParameters();
    qp.setRowSelection( selection );
    qp.setCacheable( cacheable );
    qp.setCacheRegion( cacheRegion );
    qp.setReadOnly( readOnly );
    return qp;
  }
View Full Code Here

    errorIfDML();
    QueryNode query = ( QueryNode ) sqlAst;
    boolean hasLimit = queryParameters.getRowSelection() != null && queryParameters.getRowSelection().definesLimits();
    boolean needsDistincting = ( query.getSelectClause().isDistinct() || hasLimit ) && containsCollectionFetches();

    QueryParameters queryParametersToUse;
    if ( hasLimit && containsCollectionFetches() ) {
      LOG.firstOrMaxResultsSpecifiedWithCollectionFetch();
      RowSelection selection = new RowSelection();
      selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() );
      selection.setTimeout( queryParameters.getRowSelection().getTimeout() );
View Full Code Here

    return buildQueryParametersObject();
  }

  @Override
  public QueryParameters buildQueryParametersObject() {
    final QueryParameters qp = super.buildQueryParametersObject();
    // both of these are for documentation purposes, they are actually handled directly...
    qp.setAutoDiscoverScalarTypes( true );
    qp.setCallable( true );
    return qp;
  }
View Full Code Here

  public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException {
    verifyParameters();
    Map namedParams = getNamedParams();
    before();
    QueryParameters qp = getQueryParameters(namedParams);
    qp.setScrollMode(scrollMode);
    try {
      return getSession().scroll( expandParameterLists(namedParams), qp );
    }
    finally {
      after();
View Full Code Here

    final Type[] types = new Type[ids.length];
    Arrays.fill( types, idType );
    List result;
    try {
      final QueryParameters qp = new QueryParameters();
      qp.setPositionalParameterTypes( types );
      qp.setPositionalParameterValues( ids );
      qp.setLockOptions( lockOptions );

      result = executeLoad(
          session,
          qp,
          staticLoadQuery,
View Full Code Here

  @Override
  public Object load(Serializable id, Object optionalObject, SessionImplementor session, LockOptions lockOptions) {

    final Object result;
    try {
      final QueryParameters qp = new QueryParameters();
      qp.setPositionalParameterTypes( new Type[] { entityPersister.getIdentifierType() } );
      qp.setPositionalParameterValues( new Object[] { id } );
      qp.setOptionalObject( optionalObject );
      qp.setOptionalEntityName( entityPersister.getEntityName() );
      qp.setOptionalId( id );
      qp.setLockOptions( lockOptions );

      final List results = executeLoad(
          session,
          qp,
          staticLoadQuery,
View Full Code Here

      Object optionalObject,
      LockOptions lockOptions) {
    Type[] types = new Type[ids.length];
    Arrays.fill( types, persister().getIdentifierType() );

    QueryParameters qp = new QueryParameters();
    qp.setPositionalParameterTypes( types );
    qp.setPositionalParameterValues( ids );
    qp.setOptionalObject( optionalObject );
    qp.setOptionalEntityName( persister().getEntityName() );
    qp.setOptionalId( id );
    qp.setLockOptions( lockOptions );
    return qp;
  }
View Full Code Here

      LockOptions lockOptions) {
    if ( log.isDebugEnabled() ) {
      log.debugf( "Batch loading entity: %s", MessageHelper.infoString( persister, ids, session.getFactory() ) );
    }

    QueryParameters qp = buildQueryParameters( id, ids, optionalObject, lockOptions );

    try {
      final List results = loaderToUse.doQueryAndInitializeNonLazyCollections( session, qp, false );
      log.debug( "Done entity batch load" );
      return getObjectFromList(results, id, session);
View Full Code Here

    errorIfDML();
    QueryNode query = ( QueryNode ) sqlAst;
    boolean hasLimit = queryParameters.getRowSelection() != null && queryParameters.getRowSelection().definesLimits();
    boolean needsDistincting = ( query.getSelectClause().isDistinct() || hasLimit ) && containsCollectionFetches();

    QueryParameters queryParametersToUse;
    if ( hasLimit && containsCollectionFetches() ) {
      LOG.firstOrMaxResultsSpecifiedWithCollectionFetch();
      RowSelection selection = new RowSelection();
      selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() );
      selection.setTimeout( queryParameters.getRowSelection().getTimeout() );
View Full Code Here

TOP

Related Classes of org.hibernate.engine.spi.QueryParameters

Copyright © 2018 www.massapicom. 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.