Package org.hibernate.metamodel.binding

Examples of org.hibernate.metamodel.binding.HibernateTypeDescriptor


    return null;
  }

  private void pushHibernateTypeInformationDownIfNeeded(SingularAttributeBinding attributeBinding, Type resolvedHibernateType) {

    final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
    final SingularAttribute singularAttribute = SingularAttribute.class.cast( attributeBinding.getAttribute() );
    final Value value = attributeBinding.getValue();
    if ( ! singularAttribute.isTypeResolved() && hibernateTypeDescriptor.getJavaTypeName() != null ) {
      singularAttribute.resolveType( metadata.makeJavaType( hibernateTypeDescriptor.getJavaTypeName() ) );
    }

    // sql type information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    this.pushHibernateTypeInformationDownIfNeeded(
        hibernateTypeDescriptor, value, resolvedHibernateType
View Full Code Here


    return null;
  }

  private void pushHibernateTypeInformationDownIfNeeded(SingularAttributeBinding attributeBinding, Type resolvedHibernateType) {

    final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
    final SingularAttribute singularAttribute = SingularAttribute.class.cast( attributeBinding.getAttribute() );
    final Value value = attributeBinding.getValue();
    if ( ! singularAttribute.isTypeResolved() && hibernateTypeDescriptor.getJavaTypeName() != null ) {
      singularAttribute.resolveType( metadata.makeJavaType( hibernateTypeDescriptor.getJavaTypeName() ) );
    }

    // sql type information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    this.pushHibernateTypeInformationDownIfNeeded(
        hibernateTypeDescriptor, value, resolvedHibernateType
View Full Code Here

    return null;
  }

  private void pushHibernateTypeInformationDownIfNeeded(SingularAttributeBinding attributeBinding, Type resolvedHibernateType) {

    final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
    final SingularAttribute singularAttribute = SingularAttribute.class.cast( attributeBinding.getAttribute() );
    final Value value = attributeBinding.getValue();
    if ( ! singularAttribute.isTypeResolved() && hibernateTypeDescriptor.getJavaTypeName() != null ) {
      singularAttribute.resolveType( metadata.makeJavaType( hibernateTypeDescriptor.getJavaTypeName() ) );
    }

    // sql type information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    this.pushHibernateTypeInformationDownIfNeeded(
        hibernateTypeDescriptor, value, resolvedHibernateType
View Full Code Here

    if ( attributeBinding.getHibernateTypeDescriptor().getExplicitType() != null ) {
      return attributeBinding.getHibernateTypeDescriptor().getExplicitType(); // already resolved
    }

    // this only works for "basic" attribute types
    HibernateTypeDescriptor typeDescriptor = attributeBinding.getHibernateTypeDescriptor();
    if ( typeDescriptor == null || typeDescriptor.getTypeName() == null) {
      throw new MappingException( "Hibernate type name has not been defined for attribute: " +
          getQualifiedAttributeName( attributeBinding )
      );
    }
    Type type = null;
    if ( typeDescriptor.getTypeName() != null ) {
      Properties typeParameters = null;
      if ( typeDescriptor.getTypeParameters() != null ) {
        typeParameters = new Properties();
        typeParameters.putAll( typeDescriptor.getTypeParameters() );
      }
      type = metadata.getTypeResolver().heuristicType(
              typeDescriptor.getTypeName(),
              typeParameters
          );
      typeDescriptor.setExplicitType( type );
    }
    return type;
  }
View Full Code Here

  }

  private void resolveTypeInformation(AttributeBinding attributeBinding) {
    // perform any needed type resolutions

    final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();

    Type resolvedHibernateType = hibernateTypeDescriptor.getResolvedTypeMapping();
    if ( resolvedHibernateType == null ) {
      resolvedHibernateType = determineHibernateType( attributeBinding );
      if ( resolvedHibernateType != null ) {
        hibernateTypeDescriptor.setResolvedTypeMapping( resolvedHibernateType );
      }
    }

    if ( resolvedHibernateType != null ) {
      pushHibernateTypeInformationDownIfNeeded( attributeBinding, resolvedHibernateType );
View Full Code Here

    return null;
  }

  private void pushHibernateTypeInformationDownIfNeeded(AttributeBinding attributeBinding, Type resolvedHibernateType) {
    final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();

    // java type information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    if ( hibernateTypeDescriptor.getJavaTypeName() == null ) {
      hibernateTypeDescriptor.setJavaTypeName( resolvedHibernateType.getReturnedClass().getName() );
    }

    if ( SingularAttribute.class.isInstance( attributeBinding.getAttribute() ) ) {
      final SingularAttribute singularAttribute = (SingularAttribute) attributeBinding.getAttribute();
      if ( ! singularAttribute.isTypeResolved() ) {
        if ( hibernateTypeDescriptor.getJavaTypeName() != null ) {
          singularAttribute.resolveType( metadata.makeJavaType( hibernateTypeDescriptor.getJavaTypeName() ) );
        }
      }
    }

View Full Code Here

  HbmCollectionElementDomainState(XMLElementElement element) {
    this.element = element;
  }

  public final HibernateTypeDescriptor getHibernateTypeDescriptor() {
    HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
    hibernateTypeDescriptor.setTypeName( element.getTypeAttribute() );
    return hibernateTypeDescriptor;
  }
View Full Code Here

    return null;
  }

  private void pushHibernateTypeInformationDownIfNeeded(SingularAttributeBinding attributeBinding, Type resolvedHibernateType) {

    final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
    final SingularAttribute singularAttribute = SingularAttribute.class.cast( attributeBinding.getAttribute() );
    final Value value = attributeBinding.getValue();
    if ( ! singularAttribute.isTypeResolved() && hibernateTypeDescriptor.getJavaTypeName() != null ) {
      singularAttribute.resolveType( metadata.makeJavaType( hibernateTypeDescriptor.getJavaTypeName() ) );
    }

    // sql type information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    this.pushHibernateTypeInformationDownIfNeeded(
        hibernateTypeDescriptor, value, resolvedHibernateType
View Full Code Here

  private final PropertyGeneration propertyGeneration = null;
  private final HibernateTypeDescriptor typeDescriptor;
  private final Attribute attribute;

  public AttributeDomainState(EntityBinding entityBinding, MappedAttribute mappedAttribute) {
    typeDescriptor = new HibernateTypeDescriptor();
    typeDescriptor.setTypeName( mappedAttribute.getType().getName() );

    Entity entity = entityBinding.getEntity();
    attribute = entity.getOrCreateSingularAttribute( mappedAttribute.getName() );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.metamodel.binding.HibernateTypeDescriptor

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.