Examples of EntityBinding


Examples of org.hibernate.metamodel.binding.EntityBinding

        .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

Examples of org.hibernate.metamodel.binding.EntityBinding

    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

Examples of org.hibernate.metamodel.binding.EntityBinding

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

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

Examples of org.hibernate.metamodel.binding.EntityBinding

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

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

Examples of org.hibernate.metamodel.binding.EntityBinding

   *
   * @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

Examples of org.hibernate.metamodel.binding.EntityBinding

    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

Examples of org.hibernate.metamodel.binding.EntityBinding

      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

Examples of org.hibernate.metamodel.binding.EntityBinding

      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

Examples of org.hibernate.metamodel.binding.EntityBinding

  }

  private EntityBinding makeRootEntityBinding(RootEntitySource entitySource) {
    currentHierarchyEntityMode = entitySource.getEntityMode();

    final EntityBinding entityBinding = buildBasicEntityBinding( entitySource, null );

    bindPrimaryTable( entitySource, entityBinding );

    bindIdentifier( entitySource, entityBinding );
    bindVersion( entityBinding, entitySource );
    bindDiscriminator( entitySource, entityBinding );

    entityBinding.getHierarchyDetails().setCaching( entitySource.getCaching() );
    entityBinding.getHierarchyDetails().setExplicitPolymorphism( entitySource.isExplicitPolymorphism() );
    entityBinding.getHierarchyDetails().setOptimisticLockStyle( entitySource.getOptimisticLockStyle() );

    entityBinding.setMutable( entitySource.isMutable() );
    entityBinding.setWhereFilter( entitySource.getWhere() );
    entityBinding.setRowId( entitySource.getRowId() );

    return entityBinding;
  }
View Full Code Here

Examples of org.hibernate.metamodel.binding.EntityBinding

    return entityBinding;
  }

  private EntityBinding buildBasicEntityBinding(EntitySource entitySource, EntityBinding superEntityBinding) {
    final EntityBinding entityBinding = superEntityBinding == null
        ? new EntityBinding( currentInheritanceType, currentHierarchyEntityMode )
        : new EntityBinding( superEntityBinding );

    final String entityName = entitySource.getEntityName();
    final String className = currentHierarchyEntityMode == EntityMode.POJO ? entitySource.getClassName() : null;

    final Entity entity = new Entity(
        entityName,
        className,
        currentBindingContext.makeClassReference( className ),
        superEntityBinding == null ? null : superEntityBinding.getEntity()
    );
    entityBinding.setEntity( entity );

    entityBinding.setJpaEntityName( entitySource.getJpaEntityName() );

    if ( currentHierarchyEntityMode == EntityMode.POJO ) {
      final String proxy = entitySource.getProxy();
      if ( proxy != null ) {
        entityBinding.setProxyInterfaceType(
            currentBindingContext.makeClassReference(
                currentBindingContext.qualifyClassName( proxy )
            )
        );
        entityBinding.setLazy( true );
      }
      else if ( entitySource.isLazy() ) {
        entityBinding.setProxyInterfaceType( entityBinding.getEntity().getClassReferenceUnresolved() );
        entityBinding.setLazy( true );
      }
    }
    else {
      entityBinding.setProxyInterfaceType( null );
      entityBinding.setLazy( entitySource.isLazy() );
    }

    final String customTuplizerClassName = entitySource.getCustomTuplizerClassName();
    if ( customTuplizerClassName != null ) {
      entityBinding.setCustomEntityTuplizerClass(
          currentBindingContext.<EntityTuplizer>locateClassByName(
              customTuplizerClassName
          )
      );
    }

    final String customPersisterClassName = entitySource.getCustomPersisterClassName();
    if ( customPersisterClassName != null ) {
      entityBinding.setCustomEntityPersisterClass(
          currentBindingContext.<EntityPersister>locateClassByName(
              customPersisterClassName
          )
      );
    }

    entityBinding.setMetaAttributeContext( buildMetaAttributeContext( entitySource ) );

    entityBinding.setDynamicUpdate( entitySource.isDynamicUpdate() );
    entityBinding.setDynamicInsert( entitySource.isDynamicInsert() );
    entityBinding.setBatchSize( entitySource.getBatchSize() );
    entityBinding.setSelectBeforeUpdate( entitySource.isSelectBeforeUpdate() );
    entityBinding.setAbstract( entitySource.isAbstract() );

    entityBinding.setCustomLoaderName( entitySource.getCustomLoaderName() );
    entityBinding.setCustomInsert( entitySource.getCustomSqlInsert() );
    entityBinding.setCustomUpdate( entitySource.getCustomSqlUpdate() );
    entityBinding.setCustomDelete( entitySource.getCustomSqlDelete() );

    if ( entitySource.getSynchronizedTableNames() != null ) {
      entityBinding.addSynchronizedTableNames( entitySource.getSynchronizedTableNames() );
    }

    entityBinding.setJpaCallbackClasses(entitySource.getJpaCallbackClasses());

    return entityBinding;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.