Package org.hibernate.impl

Examples of org.hibernate.impl.AbstractQueryImpl


          queryName
        );
    }
   
    //TODO: is there a more elegant way than downcasting?
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedSQLQuery(queryName);
    if ( query.getNamedParameters().length>0 ) {
      query.setParameter(
          query.getNamedParameters()[0],
          key,
          persister.getKeyType()
        );
    }
    else {
      query.setParameter( 0, key, persister.getKeyType() );
    }
    query.setCollectionKey( key )
        .setFlushMode( FlushMode.MANUAL )
        .list();

  }
View Full Code Here


          "loading entity: " + persister.getEntityName() +
          " using named query: " + queryName
        );
    }
   
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedQuery(queryName);
    if ( query.hasNamedParameters() ) {
      query.setParameter(
          query.getNamedParameters()[0],
          id,
          persister.getIdentifierType()
        );
    }
    else {
      query.setParameter( 0, id, persister.getIdentifierType() );
    }
    query.setOptionalId(id);
    query.setOptionalEntityName( persister.getEntityName() );
    query.setOptionalObject(optionalObject);
    query.setFlushMode( FlushMode.MANUAL );
    query.list();
   
    // now look up the object we are really interested in!
    // (this lets us correctly handle proxies and multi-row
    // or multi-column queries)
    return session.getPersistenceContext()
View Full Code Here

          queryName
        );
    }
   
    //TODO: is there a more elegant way than downcasting?
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedSQLQuery(queryName);
    if ( query.getNamedParameters().length>0 ) {
      query.setParameter(
          query.getNamedParameters()[0],
          key,
          persister.getKeyType()
        );
    }
    else {
      query.setParameter( 0, key, persister.getKeyType() );
    }
    query.setCollectionKey( key )
        .setFlushMode( FlushMode.MANUAL )
        .list();

  }
View Full Code Here

          "loading entity: " + persister.getEntityName() +
          " using named query: " + queryName
        );
    }
   
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedQuery(queryName);
    if ( query.hasNamedParameters() ) {
      query.setParameter(
          query.getNamedParameters()[0],
          id,
          persister.getIdentifierType()
        );
    }
    else {
      query.setParameter( 0, id, persister.getIdentifierType() );
    }
    query.setOptionalId(id);
    query.setOptionalEntityName( persister.getEntityName() );
    query.setOptionalObject(optionalObject);
    query.setFlushMode( FlushMode.MANUAL );
    query.list();
   
    // now look up the object we are really interested in!
    // (this lets us correctly handle proxies and multi-row
    // or multi-column queries)
    return session.getPersistenceContext()
View Full Code Here

    if ( ! AbstractQueryImpl.class.isInstance( query ) ) {
      throw new IllegalStateException( "Unknown query type for parameter extraction" );
    }

    HashSet<Parameter<?>> parameters = new HashSet<Parameter<?>>();
    AbstractQueryImpl queryImpl = AbstractQueryImpl.class.cast( query );

    // extract named params
    for ( String name : (Set<String>) queryImpl.getParameterMetadata().getNamedParameterNames() ) {
      final NamedParameterDescriptor descriptor =
          queryImpl.getParameterMetadata().getNamedParameterDescriptor( name );
      Class javaType = namedParameterTypeRedefinition.get( name );
      if ( javaType != null && mightNeedRedefinition( javaType ) ) {
        descriptor.resetExpectedType(
            sfi().getTypeResolver().heuristicType( javaType.getName() )
        );
      }
      else if ( descriptor.getExpectedType() != null ) {
        javaType = descriptor.getExpectedType().getReturnedClass();
      }
      final ParameterImpl parameter = new ParameterImpl( name, javaType );
      parameters.add( parameter );
      if ( descriptor.isJpaStyle() ) {
        if ( jpaPositionalIndices == null ) {
          jpaPositionalIndices = new HashSet<Integer>();
        }
        jpaPositionalIndices.add( Integer.valueOf( name ) );
      }
    }

    // extract positional parameters
    for ( int i = 0, max = queryImpl.getParameterMetadata().getOrdinalParameterCount(); i < max; i++ ) {
      final OrdinalParameterDescriptor descriptor =
          queryImpl.getParameterMetadata().getOrdinalParameterDescriptor( i+1 );
      ParameterImpl parameter = new ParameterImpl(
          i + 1,
          descriptor.getExpectedType() == null
              ? null
              : descriptor.getExpectedType().getReturnedClass()
View Full Code Here

          "loading entity: " + persister.getEntityName() +
          " using named query: " + queryName
        );
    }
   
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedQuery(queryName);
    if ( query.hasNamedParameters() ) {
      query.setParameter(
          query.getNamedParameters()[0],
          id,
          persister.getIdentifierType()
        );
    }
    else {
      query.setParameter( 0, id, persister.getIdentifierType() );
    }
    query.setOptionalId(id);
    query.setOptionalEntityName( persister.getEntityName() );
    query.setOptionalObject(optionalObject);
    query.setFlushMode( FlushMode.MANUAL );
    query.list();
   
    // now look up the object we are really interested in!
    // (this lets us correctly handle proxies and multi-row
    // or multi-column queries)
    return session.getPersistenceContext()
View Full Code Here

        result = query.list();
        if ( maxResults != -1 ) {
          query.setMaxResults( maxResults ); //put back the original value
        }
        else {
          AbstractQueryImpl queryImpl = AbstractQueryImpl.class.cast( query );
          queryImpl.getSelection().setMaxRows( null );
        }
      }
      else {
        //we can't do much because we cannot reset the maxResults => do the full list call
        //Not tremendously bad as the user is doing a fault here anyway by calling getSingleREsults on a big list
View Full Code Here

          queryName
        );
    }
   
    //TODO: is there a more elegant way than downcasting?
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedSQLQuery(queryName);
    if ( query.getNamedParameters().length>0 ) {
      query.setParameter(
          query.getNamedParameters()[0],
          key,
          persister.getKeyType()
        );
    }
    else {
      query.setParameter( 0, key, persister.getKeyType() );
    }
    query.setCollectionKey( key )
        .setFlushMode( FlushMode.MANUAL )
        .list();

  }
View Full Code Here

          "loading entity: " + persister.getEntityName() +
          " using named query: " + queryName
        );
    }
   
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedQuery(queryName);
    if ( query.hasNamedParameters() ) {
      query.setParameter(
          query.getNamedParameters()[0],
          id,
          persister.getIdentifierType()
        );
    }
    else {
      query.setParameter( 0, id, persister.getIdentifierType() );
    }
    query.setOptionalId(id);
    query.setOptionalEntityName( persister.getEntityName() );
    query.setOptionalObject(optionalObject);
    query.setFlushMode( FlushMode.MANUAL );
    query.list();
   
    // now look up the object we are really interested in!
    // (this lets us correctly handle proxies and multi-row
    // or multi-column queries)
    return session.getPersistenceContext()
View Full Code Here

          queryName
        );
    }
   
    //TODO: is there a more elegant way than downcasting?
    AbstractQueryImpl query = (AbstractQueryImpl) session.getNamedSQLQuery(queryName);
    if ( query.getNamedParameters().length>0 ) {
      query.setParameter(
          query.getNamedParameters()[0],
          key,
          persister.getKeyType()
        );
    }
    else {
      query.setParameter( 0, key, persister.getKeyType() );
    }
    query.setCollectionKey( key )
        .setFlushMode( FlushMode.MANUAL )
        .list();

  }
View Full Code Here

TOP

Related Classes of org.hibernate.impl.AbstractQueryImpl

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.