Package org.hibernate.engine.query

Examples of org.hibernate.engine.query.NamedParameterDescriptor


    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()
      );
      parameters.add( parameter );
      Integer position = descriptor.getOrdinalPosition();
            if (jpaPositionalIndices != null && jpaPositionalIndices.contains(position)) LOG.parameterPositionOccurredAsBothJpaAndHibernatePositionalParameter(position);
    }

    this.parameters = java.util.Collections.unmodifiableSet( parameters );
  }
View Full Code Here


    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 ) {
        descriptor.resetExpectedType(
            TypeFactory.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()
      );
      parameters.add( parameter );
      Integer position = descriptor.getOrdinalPosition();
      if ( jpaPositionalIndices != null && jpaPositionalIndices.contains( position ) ) {
        log.warn( "Parameter position [" + position + "] occurred as both JPA and Hibernate positional parameter" );
      }
    }
View Full Code Here

    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 ) {
        descriptor.resetExpectedType(
            TypeFactory.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()
      );
      parameters.add( parameter );
      Integer position = descriptor.getOrdinalPosition();
      if ( jpaPositionalIndices != null && jpaPositionalIndices.contains( position ) ) {
        log.warn( "Parameter position [" + position + "] occurred as both JPA and Hibernate positional parameter" );
      }
    }
View Full Code Here

    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(
            TypeFactory.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()
      );
      parameters.add( parameter );
      Integer position = descriptor.getOrdinalPosition();
      if ( jpaPositionalIndices != null && jpaPositionalIndices.contains( position ) ) {
        log.warn( "Parameter position [" + position + "] occurred as both JPA and Hibernate positional parameter" );
      }
    }
View Full Code Here

    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()
      );
      parameters.add( parameter );
      Integer position = descriptor.getOrdinalPosition();
      if ( jpaPositionalIndices != null && jpaPositionalIndices.contains( position ) ) {
        log.warn( "Parameter position [" + position + "] occurred as both JPA and Hibernate positional parameter" );
      }
    }
View Full Code Here

    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()
      );
      parameters.add( parameter );
      Integer position = descriptor.getOrdinalPosition();
      if ( jpaPositionalIndices != null && jpaPositionalIndices.contains( position ) ) {
        log.warn( "Parameter position [" + position + "] occurred as both JPA and Hibernate positional parameter" );
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.engine.query.NamedParameterDescriptor

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.