Examples of TypedValue


Examples of org.hibernate.engine.spi.TypedValue

          value = nullableType.fromStringValue( stringValue );
        }
        else {
          throw new QueryException( "Unsupported discriminator type " + type );
        }
        return new TypedValue( type, value );
      }
    }
    // Otherwise, this is an ordinary value.
    return new TypedValue( getTypeUsingProjection( subcriteria, propertyName ), value );
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

  protected SQLCriterion(String sql, Object[] values, Type[] types) {
    this.sql = sql;
    this.typedValues = new TypedValue[values.length];
    for ( int i=0; i<typedValues.length; i++ ) {
      typedValues[i] = new TypedValue( types[i], values[i] );
    }
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

    }
  }

  protected SQLCriterion(String sql, Object value, Type type) {
    this.sql = sql;
    this.typedValues = new TypedValue[] { new TypedValue( type, value ) };
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

        if ( isLikeEnabled ) {
          string = matchMode.toMatchString( string );
        }
        value = string;
      }
      list.add( new TypedValue( type, value ) );
    }
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

    if ( CollectionHelper.isEmpty( namedParams ) ) {
      return result;
    }

    for ( String name : namedParams.keySet() ) {
      TypedValue typedValue = namedParams.get( name );
      int columnSpan = typedValue.getType().getColumnSpan( getFactory() );
      int[] locs = getNamedParameterLocs( name );
      for ( int loc : locs ) {
        if ( DEBUG_ENABLED ) {
          LOG.debugf(
              "bindNamedParameters() %s -> %s [%s]",
              typedValue.getValue(),
              name,
              loc + startIndex
          );
        }
        int start = loc * columnSpan + startIndex;
        typedValue.getType().nullSafeSet( statement, typedValue.getValue(), start, session );
      }
      result += locs.length;
    }
    return result;
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

  @Override
  public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    final TypedValue[] subQueryTypedValues = super.getTypedValues( criteria, criteriaQuery );
    final TypedValue[] result = new TypedValue[subQueryTypedValues.length+1];
    System.arraycopy( subQueryTypedValues, 0, result, 1, subQueryTypedValues.length );
    result[0] = new TypedValue( getTypes()[0], value );
    return result;
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

  public Query setParameter(String name, Object val, Type type) {
    if ( !parameterMetadata.getNamedParameterNames().contains( name ) ) {
      throw new IllegalArgumentException("Parameter " + name + " does not exist as a named parameter in [" + getQueryString() + "]");
    }
    else {
       namedParameters.put( name, new TypedValue( type, val  ) );
       return this;
    }
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

  @Override
  public Query setParameterList(String name, Collection vals, Type type) throws HibernateException {
    if ( !parameterMetadata.getNamedParameterNames().contains( name ) ) {
      throw new IllegalArgumentException("Parameter " + name + " does not exist as a named parameter in [" + getQueryString() + "]");
    }
    namedParameterLists.put( name, new TypedValue( type, vals ) );
    return this;
  }
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

        StringHelper.getFirstNonWhitespaceCharacter( afterPlaceholder ) == ')';

    if ( vals.size() == && isEnclosedInParens ) {
      // short-circuit for performance when only 1 value and the
      // placeholder is already enclosed in parentheses...
      namedParamsCopy.put( name, new TypedValue( type, vals.iterator().next() ) );
      return query;
    }

    StringBuilder list = new StringBuilder( 16 );
    Iterator iter = vals.iterator();
    int i = 0;
    while ( iter.hasNext() ) {
      // Variable 'name' can represent a number or contain digit at the end. Surrounding it with
      // characters to avoid ambiguous definition after concatenating value of 'i' counter.
      String alias = ( isJpaPositionalParam ? 'x' + name : name ) + '_' + i++ + '_';
      if ( namedParamsCopy.put( alias, new TypedValue( type, iter.next() ) ) != null ) {
        throw new HibernateException( "Repeated usage of alias '" + alias + "' while expanding list parameter." );
      }
      list.append( ParserHelper.HQL_VARIABLE_PREFIX ).append( alias );
      if ( iter.hasNext() ) {
        list.append( ", " );
View Full Code Here

Examples of org.hibernate.engine.spi.TypedValue

      final Iterator iter = namedParams.entrySet().iterator();
      int result = 0;
      while ( iter.hasNext() ) {
        final Map.Entry e = (Map.Entry) iter.next();
        final String name = (String) e.getKey();
        final TypedValue typedval = (TypedValue) e.getValue();
        final int[] locs = getNamedParameterLocs( name );
        for ( int loc : locs ) {
          LOG.debugf( "bindNamedParameters() %s -> %s [%s]", typedval.getValue(), name, loc + start );
          typedval.getType().nullSafeSet(
              ps,
              typedval.getValue(),
              loc + start,
              session
          );
        }
        result += locs.length;
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.