Package org.hibernate.engine

Examples of org.hibernate.engine.TypedValue


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


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

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

      for ( int i=0; i<types.length; i++ ) {
        for ( int j=0; j<values.length; j++ ) {
          Object subval = values[j]==null ?
            null :
            actype.getPropertyValues( values[j], EntityMode.POJO )[i];
          list.add( new TypedValue( types[i], subval, EntityMode.POJO ) );
        }
      }
    }
    else {
      for ( int j=0; j<values.length; j++ ) {
        list.add( new TypedValue( type, values[j], EntityMode.POJO ) );
      }
    }
    return (TypedValue[]) list.toArray( new TypedValue[ list.size() ] );
  }
View Full Code Here

    Type[] ppTypes = params.getPositionalParameterTypes();
    Object[] ppValues = params.getPositionalParameterValues();
    TypedValue[] tv = new TypedValue[ppTypes.length];
    for ( int i=0; i<ppTypes.length; i++ ) {
      tv[i] = new TypedValue( ppTypes[i], ppValues[i], EntityMode.POJO );
    }
    return tv;
  }
View Full Code Here

    else {
      namedParameters = CollectionHelper.mapOfSize( queryParameters.getNamedParameters().size() );
      Iterator itr = queryParameters.getNamedParameters().entrySet().iterator();
      while ( itr.hasNext() ) {
        final Map.Entry namedParameterEntry = ( Map.Entry ) itr.next();
        final TypedValue original = ( TypedValue ) namedParameterEntry.getValue();
        namedParameters.put(
            namedParameterEntry.getKey(),
            new TypedValue(
                original.getType(),
                original.getType().disassemble( original.getValue(), session, null ),
                session.getEntityMode()
            )
        );
      }
    }
View Full Code Here

      Iterator iter = namedParams.entrySet().iterator();
      int result = 0;
      while ( iter.hasNext() ) {
        Map.Entry e = ( Map.Entry ) iter.next();
        String name = ( String ) e.getKey();
        TypedValue typedval = ( TypedValue ) e.getValue();
        int[] locs = getNamedParameterLocs( name );
        for ( int i = 0; i < locs.length; i++ ) {
          if ( log.isDebugEnabled() ) {
            log.debug(
                "bindNamedParameters() " +
                typedval.getValue() + " -> " + name +
                " [" + ( locs[i] + startIndex ) + "]"
              );
          }
          typedval.getType().nullSafeSet( statement, typedval.getValue(), locs[i] + startIndex, session );
        }
        result += locs.length;
      }
      return result;
    }
View Full Code Here

      for ( int j=0; j<values.length; j++ ) {
        for ( int i=0; i<types.length; i++ ) {
          Object subval = values[j]==null ?
            null :
            actype.getPropertyValues( values[j], EntityMode.POJO )[i];
          list.add( new TypedValue( types[i], subval, EntityMode.POJO ) );
        }
      }
    }
    else {
      for ( int j=0; j<values.length; j++ ) {
        list.add( new TypedValue( type, values[j], EntityMode.POJO ) );
      }
    }
    return (TypedValue[]) list.toArray( new TypedValue[ list.size() ] );
  }
View Full Code Here

      Iterator iter = namedParams.entrySet().iterator();
      int result = 0;
      while ( iter.hasNext() ) {
        Map.Entry e = ( Map.Entry ) iter.next();
        String name = ( String ) e.getKey();
        TypedValue typedval = ( TypedValue ) e.getValue();
        int[] locs = getNamedParameterLocs( name );
        for ( int i = 0; i < locs.length; i++ ) {
          if ( log.isDebugEnabled() ) {
            log.debug(
                "bindNamedParameters() " +
                typedval.getValue() + " -> " + name +
                " [" + ( locs[i] + startIndex ) + "]"
              );
          }
          typedval.getType().nullSafeSet( statement, typedval.getValue(), locs[i] + startIndex, session );
        }
        result += locs.length;
      }
      return result;
    }
View Full Code Here

    return ( ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) ) ).getIdentifierType();
  }

  public TypedValue getTypedIdentifierValue(Criteria subcriteria, Object value) {
    final Loadable loadable = ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) );
    return new TypedValue(
        loadable.getIdentifierType(),
            value,
            EntityMode.POJO
    );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.engine.TypedValue

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.