Package org.hibernate.type

Examples of org.hibernate.type.Type


      if (fieldIdx == null)
      {
        throw new JRRuntimeException("The HQL query does not have a \"" + fieldAlias + "\" alias.");
      }
     
      Type type = returnTypes[fieldIdx.intValue()];
      if (!type.isEntityType() && !type.isComponentType())
      {
        throw new JRRuntimeException("The HQL query does not have a \"" + fieldAlias + "\" alias.");
      }
     
      reader = new IndexPropertyFieldReader(fieldIdx.intValue(), fieldProperty);
View Full Code Here


    if (log.isDebugEnabled())
    {
      log.debug("Parameter " + hqlParamName + " of type " + clazz.getName() + ": " + parameterValue);
    }
   
    Type type = (Type) hibernateTypeMap.get(clazz);
   
    if (type != null)
    {
      query.setParameter(hqlParamName, parameterValue, type);
    }
View Full Code Here

        metadata.setPropertyValue(object, name, null, EntityMode.POJO);
      }
    }

    public EntityCollection getChildCollection(String name) throws LayerException {
      Type type = metadata.getPropertyType(name);
      if (type instanceof CollectionType) {
        CollectionType ct = (CollectionType) type;
        Collection coll = (Collection) metadata.getPropertyValue(object, name, EntityMode.POJO);
        if (coll == null) {
          // normally should not happen, hibernate instantiates it automatically
View Full Code Here

    propertyName = propertyName.replace(XPATH_SEPARATOR, SEPARATOR);

    if (propertyName.contains(SEPARATOR)) {
      String directProperty = propertyName.substring(0, propertyName.indexOf(SEPARATOR));
      try {
        Type prop = meta.getPropertyType(directProperty);
        if (prop.isCollectionType()) {
          CollectionType coll = (CollectionType) prop;
          prop = coll.getElementType((SessionFactoryImplementor) sessionFactory);
        }
        ClassMetadata propMeta = sessionFactory.getClassMetadata(prop.getReturnedClass());
        return getPropertyClass(propMeta, propertyName.substring(propertyName.indexOf(SEPARATOR) + 1));
      } catch (HibernateException e) {
        throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_COULD_NOT_RESOLVE, propertyName,
            meta.getEntityName());
      }
View Full Code Here

      sb.append(" none");
    }
    else {
      for (int i = 0; i < values.length; i++) {
        Object val = values[i];
        Type type = types[i];
        sb.append((val == null? "NULL": val.toString())).append("(").append(type.getName()).append(" ), ");
      }
    }
    sb.append(", query: ").append(query);
    Tracing.logDebug(sb.toString(),DBManager.class);
  }
View Full Code Here

    }
    return result;
  }

  public Metadata getPropertyType(String property) {
    Type pType = metadata.getPropertyType(property);
    Class<?> pCollectionType = null;
    if (pType.isCollectionType()) {
      pType = ((CollectionType)pType).getElementType((SessionFactoryImplementor) sessionFactory);
      pCollectionType = pType.getReturnedClass();
    }
   
    if (pType.isEntityType()) {
      return new HibernateEntityMetadata(sessionFactory, sessionFactory.getClassMetadata(((EntityType)pType).getName()), pCollectionType);
    } else {
      return new HibernateNonEntityMetadata(sessionFactory, pType, pCollectionType);
    }
  }
View Full Code Here

   
    int i = getPropertyIndex(property);
    if (i == -1) {
      return null;
    } else {
      Type pType = ((ComponentType)type).getSubtypes()[i];
      Class<?> pCollectionType = null;
      if (pType.isCollectionType()) {
        pType = ((CollectionType)pType).getElementType((SessionFactoryImplementor) sessionFactory);
        pCollectionType = pType.getReturnedClass();
      }
      if (pType.isEntityType()) {
        return new HibernateEntityMetadata(sessionFactory, sessionFactory.getClassMetadata(((EntityType)pType).getName()), pCollectionType);
      } else {
        return new HibernateNonEntityMetadata(sessionFactory, pType, pCollectionType);
      }
    }
View Full Code Here

      Element returnElem = (Element) returns.next();
      String name = returnElem.getName();
      if ( "return-scalar".equals( name ) ) {
        String column = returnElem.attributeValue( "column" );
        String typeFromXML = HbmBinder.getTypeFromXML( returnElem );
        Type type = null;
        if(typeFromXML!=null) {
          type = mappings.getTypeResolver().heuristicType( typeFromXML );
          if ( type == null ) {
            throw new MappingException( "could not determine type " + type );
          }
View Full Code Here

    if ( propertyPath.size() > 1 ) {
      throw new UnsupportedOperationException( "Queries on embedded/associated entities are not supported yet." );
    }
    OgmEntityPersister persister = getPersister( entityType );
    Type propertyType = persister.getPropertyType( propertyPath.get( propertyPath.size() - 1 ) );
    if ( propertyType instanceof AbstractStandardBasicType ) {
      return ( (AbstractStandardBasicType<?>) propertyType ).fromString( value );
    }
    else {
      return value;
View Full Code Here

  public Object convertToLiteral(String entityType, List<String> propertyPath, Object value) {
    if ( propertyPath.size() > 1 ) {
      throw new UnsupportedOperationException( "Queries on embedded/associated entities are not supported yet." );
    }
    OgmEntityPersister persister = getPersister( entityType );
    Type propertyType = persister.getPropertyType( propertyPath.get( propertyPath.size() - 1 ) );
    Object gridValue = convertToGridType( value, propertyType );
    return gridValue;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.type.Type

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.