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

    Map<String,ClassMetadata> classMeta = new HashMap<String,ClassMetadata>();
    for ( EntityBinding model : metadata.getEntityBindings() ) {
      // TODO: should temp table prep happen when metadata is being built?
      //model.prepareTemporaryTables( metadata, getDialect() );
      // cache region is defined by the root-class in the hierarchy...
      EntityBinding rootEntityBinding = metadata.getRootEntityBinding( model.getEntity().getName() );
      EntityRegionAccessStrategy accessStrategy = null;
      if ( settings.isSecondLevelCacheEnabled() &&
          rootEntityBinding.getHierarchyDetails().getCaching() != null &&
          model.getHierarchyDetails().getCaching() != null &&
          model.getHierarchyDetails().getCaching().getAccessType() != null ) {
        final String cacheRegionName = cacheRegionPrefix + rootEntityBinding.getHierarchyDetails().getCaching().getRegion();
        accessStrategy = EntityRegionAccessStrategy.class.cast( entityAccessStrategies.get( cacheRegionName ) );
        if ( accessStrategy == null ) {
          final AccessType accessType = model.getHierarchyDetails().getCaching().getAccessType();
          if ( LOG.isTraceEnabled() ) {
            LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() );
View Full Code Here

    Map<String,ClassMetadata> classMeta = new HashMap<String,ClassMetadata>();
    for ( EntityBinding model : metadata.getEntityBindings() ) {
      // TODO: should temp table prep happen when metadata is being built?
      //model.prepareTemporaryTables( metadata, getDialect() );
      // cache region is defined by the root-class in the hierarchy...
      EntityBinding rootEntityBinding = metadata.getRootEntityBinding( model.getEntity().getName() );
      EntityRegionAccessStrategy accessStrategy = null;
      if ( settings.isSecondLevelCacheEnabled() &&
          rootEntityBinding.getHierarchyDetails().getCaching() != null &&
          model.getHierarchyDetails().getCaching() != null &&
          model.getHierarchyDetails().getCaching().getAccessType() != null ) {
        final String cacheRegionName = cacheRegionPrefix + rootEntityBinding.getHierarchyDetails().getCaching().getRegion();
        accessStrategy = EntityRegionAccessStrategy.class.cast( entityAccessStrategies.get( cacheRegionName ) );
        if ( accessStrategy == null ) {
          final AccessType accessType = model.getHierarchyDetails().getCaching().getAccessType();
          if ( traceEnabled ) {
            LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() );
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

    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

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.