Package org.hibernate.engine

Examples of org.hibernate.engine.TypedValue


    java.util.Set currentIds = new HashSet();
    for ( Iterator it=currentElements.iterator(); it.hasNext(); ) {
      Object current = it.next();
      if ( current!=null && ForeignKeys.isNotTransient(entityName, current, null, session) ) {
        Serializable currentId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, current, session);
        currentIds.add( new TypedValue( idType, currentId, session.getEntityMode() ) );
      }
    }

    // iterate over the *old* list
    for ( Iterator it=oldElements.iterator(); it.hasNext(); ) {
      Object old = it.next();
      Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session);
      if ( !currentIds.contains( new TypedValue( idType, oldId, session.getEntityMode() ) ) ) {
        res.add(old);
      }
    }

    return res;
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

  protected SQLCriterion(String sql, Object[] values, Type[] types) {
    this.sql = sql;
    typedValues = new TypedValue[values.length];
    for ( int i=0; i<typedValues.length; i++ ) {
      typedValues[i] = new TypedValue( types[i], values[i], EntityMode.POJO );
    }
  }
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] + start ) + "]" );
          }
          typedval.getType().nullSafeSet( ps, typedval.getValue(),
              locs[i] + start, session );
        }
        result += locs.length;
      }
      return result;
View Full Code Here

    filterName = name;
    Iterator iter = params.entrySet().iterator();
    while ( iter.hasNext() ) {
      Map.Entry me = (Map.Entry) iter.next();
      Type type = (Type) types.get( me.getKey() );
      filterParameters.put( me.getKey(), new TypedValue( type, me.getValue(), entityMode ) );
    }
  }
View Full Code Here

  }

  public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
  throws HibernateException {
    return new TypedValue[] {
      new TypedValue( Hibernate.INTEGER, new Integer(size), 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

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

   *
   * @return The number of sql bind positions "eaten" by this bind operation.
   */
  public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position)
          throws SQLException {
    TypedValue typedValue = ( TypedValue ) qp.getNamedParameters().get( name );
    typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session );
    return typedValue.getType().getColumnSpan( session.getFactory() );
  }
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

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.