Package org.hibernate.impl

Examples of org.hibernate.impl.AbstractQueryImpl


    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 );
      final ParameterImpl parameter = new ParameterImpl(
          name,
          descriptor.getExpectedType() == null
              ? null
              : descriptor.getExpectedType().getReturnedClass()
      );
      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(
          descriptor.getOrdinalPosition() + 1,
          descriptor.getExpectedType() == null
              ? null
              : descriptor.getExpectedType().getReturnedClass()
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

        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

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.