Package org.hibernate.metamodel.binding

Examples of org.hibernate.metamodel.binding.EntityBinding


    return entityBindingMap.get( entityName );
  }

  @Override
  public EntityBinding getRootEntityBinding(String entityName) {
    EntityBinding binding = entityBindingMap.get( entityName );
    if ( binding == null ) {
      throw new IllegalStateException( "Unknown entity binding: " + entityName );
    }

    do {
      if ( binding.isRoot() ) {
        return binding;
      }
      binding = binding.getSuperEntityBinding();
    } while ( binding != null );

    throw new AssertionFailure( "Entity binding has no root: " + entityName );
  }
View Full Code Here


    return identifierGeneratorFactory;
  }

  @Override
  public org.hibernate.type.Type getIdentifierType(String entityName) throws MappingException {
    EntityBinding entityBinding = getEntityBinding( entityName );
    if ( entityBinding == null ) {
      throw new MappingException( "Entity binding not known: " + entityName );
    }
    return entityBinding
        .getHierarchyDetails()
        .getEntityIdentifier()
        .getValueBinding()
        .getHibernateTypeDescriptor()
        .getResolvedTypeMapping();
View Full Code Here

        .getResolvedTypeMapping();
  }

  @Override
  public String getIdentifierPropertyName(String entityName) throws MappingException {
    EntityBinding entityBinding = getEntityBinding( entityName );
    if ( entityBinding == null ) {
      throw new MappingException( "Entity binding not known: " + entityName );
    }
    AttributeBinding idBinding = entityBinding.getHierarchyDetails().getEntityIdentifier().getValueBinding();
    return idBinding == null ? null : idBinding.getAttribute().getName();
  }
View Full Code Here

    return idBinding == null ? null : idBinding.getAttribute().getName();
  }

  @Override
  public org.hibernate.type.Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException {
    EntityBinding entityBinding = getEntityBinding( entityName );
    if ( entityBinding == null ) {
      throw new MappingException( "Entity binding not known: " + entityName );
    }
    // TODO: should this call EntityBinding.getReferencedAttributeBindingString), which does not exist yet?
    AttributeBinding attributeBinding = entityBinding.locateAttributeBinding( propertyName );
    if ( attributeBinding == null ) {
      throw new MappingException( "unknown property: " + entityName + '.' + propertyName );
    }
    return attributeBinding.getHibernateTypeDescriptor().getResolvedTypeMapping();
  }
View Full Code Here

    Subclass subclass = new JoinedSubclass( new RootClass() );
    resolver.getEntityPersisterClass( subclass );
  }

  private EntityBinding rootMetadata(InheritanceType inheritanceType) {
    return new EntityBinding( inheritanceType, null );
  }
View Full Code Here

  private EntityBinding rootMetadata(InheritanceType inheritanceType) {
    return new EntityBinding( inheritanceType, null );
  }

  private EntityBinding subclassMetadata(InheritanceType inheritanceType) {
    return new EntityBinding( rootMetadata( inheritanceType ) );
  }
View Full Code Here

   *
   * @param entityHierarchy THe hierarchy to process.
   */
  public void processEntityHierarchy(EntityHierarchy entityHierarchy) {
    currentInheritanceType = entityHierarchy.getHierarchyInheritanceType();
    EntityBinding rootEntityBinding = createEntityBinding( entityHierarchy.getRootEntitySource(), null );
    if ( currentInheritanceType != InheritanceType.NO_INHERITANCE ) {
      processHierarchySubEntities( entityHierarchy.getRootEntitySource(), rootEntityBinding );
    }
    currentHierarchyEntityMode = null;
  }
View Full Code Here

    currentHierarchyEntityMode = null;
  }

  private void processHierarchySubEntities(SubclassEntityContainer subclassEntitySource, EntityBinding superEntityBinding) {
    for ( SubclassEntitySource subEntity : subclassEntitySource.subclassEntitySources() ) {
      EntityBinding entityBinding = createEntityBinding( subEntity, superEntityBinding );
      processHierarchySubEntities( subEntity, entityBinding );
    }
  }
View Full Code Here

      return metadata.getEntityBinding( entitySource.getEntityName() );
    }

    currentBindingContext = entitySource.getLocalBindingContext();
    try {
      final EntityBinding entityBinding = doCreateEntityBinding( entitySource, superEntityBinding );

      metadata.addEntity( entityBinding );
      processedEntityNames.add( entityBinding.getEntity().getName() );

      processFetchProfiles( entitySource, entityBinding );

      return entityBinding;
    }
View Full Code Here

      currentBindingContext = null;
    }
  }

  private EntityBinding doCreateEntityBinding(EntitySource entitySource, EntityBinding superEntityBinding) {
    final EntityBinding entityBinding = createBasicEntityBinding( entitySource, superEntityBinding );

    bindSecondaryTables( entitySource, entityBinding );
    bindAttributes( entitySource, entityBinding );

    bindTableUniqueConstraints( entitySource, entityBinding );
View Full Code Here

TOP

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

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.