Package org.hibernate.metamodel.domain

Examples of org.hibernate.metamodel.domain.SingularAttribute


  private void bindEmbeddedAttributes(EntityBinding entityBinding, AttributeContainer attributeContainer, ConfiguredClass configuredClass) {
    for ( Map.Entry<String, EmbeddableClass> entry : configuredClass.getEmbeddedClasses().entrySet() ) {
      String attributeName = entry.getKey();
      EmbeddableClass embeddedClass = entry.getValue();
      SingularAttribute component = attributeContainer.getOrCreateComponentAttribute( attributeName );
      for ( SimpleAttribute simpleAttribute : embeddedClass.getSimpleAttributes() ) {
        bindSingleMappedAttribute(
            entityBinding,
            component.getAttributeContainer(),
            simpleAttribute
        );
      }
      for ( AssociationAttribute associationAttribute : embeddedClass.getAssociationAttributes() ) {
        bindAssociationAttribute(
            entityBinding,
            component.getAttributeContainer(),
            associationAttribute
        );
      }
    }
  }
View Full Code Here


  }

  private SimpleSingularAttributeBinding doBasicSingularAttributeBindingCreation(
      SingularAttributeSource attributeSource,
      EntityBinding entityBinding) {
    final SingularAttribute attribute = attributeSource.isVirtualAttribute()
        ? entityBinding.getEntity().locateOrCreateVirtualAttribute( attributeSource.getName() )
        : entityBinding.getEntity().locateOrCreateSingularAttribute( attributeSource.getName() );

    final SimpleSingularAttributeBinding attributeBinding;
    if ( attributeSource.getNature() == SingularAttributeNature.BASIC ) {
View Full Code Here

    }
    else {
      typeName = attributeBinding.getHibernateTypeDescriptor().getJavaTypeName();
      if ( typeName == null ) {
        if ( attributeBinding.getAttribute().isSingular() ) {
          SingularAttribute singularAttribute = (SingularAttribute) attributeBinding.getAttribute();
          if ( singularAttribute.getSingularAttributeType() != null ) {
            typeName = singularAttribute.getSingularAttributeType().getClassName();
          }
        }
      }
    }
View Full Code Here

    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

    }
  }

  private void bindComponent(ComponentAttributeSource attributeSource, AttributeBindingContainer container) {
    final String attributeName = attributeSource.getName();
    SingularAttribute attribute = container.getAttributeContainer().locateComponentAttribute( attributeName );
    if ( attribute == null ) {
      final Component component = new Component(
          attributeSource.getPath(),
          attributeSource.getClassName(),
          attributeSource.getClassReference(),
          null // component inheritance not YET supported
      );
      attribute = container.getAttributeContainer().createComponentAttribute( attributeName, component );
    }
    ComponentAttributeBinding componentAttributeBinding = container.makeComponentAttributeBinding( attribute );

    if ( StringHelper.isNotEmpty( attributeSource.getParentReferenceAttributeName() ) ) {
      final SingularAttribute parentReferenceAttribute =
          componentAttributeBinding.getComponent()
              .createSingularAttribute( attributeSource.getParentReferenceAttributeName() );
      componentAttributeBinding.setParentReference( parentReferenceAttribute );
    }
View Full Code Here

  }

  private BasicAttributeBinding doBasicSingularAttributeBindingCreation(
      SingularAttributeSource attributeSource,
      AttributeBindingContainer attributeBindingContainer) {
    final SingularAttribute existingAttribute = attributeBindingContainer.getAttributeContainer()
        .locateSingularAttribute( attributeSource.getName() );
    final SingularAttribute attribute;
    if ( existingAttribute != null ) {
      attribute = existingAttribute;
    }
    else if ( attributeSource.isVirtualAttribute() ) {
      attribute = attributeBindingContainer.getAttributeContainer().createVirtualSingularAttribute(
View Full Code Here

    resolvedType = determineSingularTypeFromDescriptor( attributeBinding.getHibernateTypeDescriptor() );
    if ( resolvedType == null ) {
      if ( ! attributeBinding.getAttribute().isSingular() ) {
        throw new AssertionFailure( "SingularAttributeBinding object has a plural attribute: " + attributeBinding.getAttribute().getName() );
      }
      final SingularAttribute singularAttribute = ( SingularAttribute ) attributeBinding.getAttribute();
      if ( singularAttribute.getSingularAttributeType() != null ) {
        resolvedType = getHeuristicType(
            singularAttribute.getSingularAttributeType().getClassName(), new Properties()
        );
      }
    }
    if ( resolvedType != null ) {
      pushHibernateTypeInformationDownIfNeeded( attributeBinding, resolvedType );
View Full Code Here

  }

  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 void bindComponent(ComponentAttributeSource attributeSource, AttributeBindingContainer container) {
    final String attributeName = attributeSource.getName();
    SingularAttribute attribute = container.getAttributeContainer().locateComponentAttribute( attributeName );
    if ( attribute == null ) {
      final Component component = new Component(
          attributeSource.getPath(),
          attributeSource.getClassName(),
          attributeSource.getClassReference(),
          null // component inheritance not YET supported
      );
      attribute = container.getAttributeContainer().createComponentAttribute( attributeName, component );
    }
    ComponentAttributeBinding componentAttributeBinding = container.makeComponentAttributeBinding( attribute );

    if ( StringHelper.isNotEmpty( attributeSource.getParentReferenceAttributeName() ) ) {
      final SingularAttribute parentReferenceAttribute =
          componentAttributeBinding.getComponent()
              .createSingularAttribute( attributeSource.getParentReferenceAttributeName() );
      componentAttributeBinding.setParentReference( parentReferenceAttribute );
    }
View Full Code Here

  }

  private BasicAttributeBinding doBasicSingularAttributeBindingCreation(
      SingularAttributeSource attributeSource,
      AttributeBindingContainer attributeBindingContainer) {
    final SingularAttribute existingAttribute = attributeBindingContainer.getAttributeContainer()
        .locateSingularAttribute( attributeSource.getName() );
    final SingularAttribute attribute;
    if ( existingAttribute != null ) {
      attribute = existingAttribute;
    }
    else if ( attributeSource.isVirtualAttribute() ) {
      attribute = attributeBindingContainer.getAttributeContainer().createVirtualSingularAttribute(
View Full Code Here

TOP

Related Classes of org.hibernate.metamodel.domain.SingularAttribute

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.