• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EntityBinding类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hibernate.metamodel.binding.EntityBinding的典型用法代码示例。如果您正苦于以下问题:Java EntityBinding类的具体用法?Java EntityBinding怎么用?Java EntityBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntityBinding类属于org.hibernate.metamodel.binding包,在下文中一共展示了EntityBinding类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createEntityBinding

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private EntityBinding createEntityBinding(EntitySource entitySource, EntityBinding superEntityBinding) {
	if ( processedEntityNames.contains( entitySource.getEntityName() ) ) {
		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;
	}
	finally {
		currentBindingContext = null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Binder.java


示例2: createBasicEntityBinding

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private EntityBinding createBasicEntityBinding(EntitySource entitySource, EntityBinding superEntityBinding) {
	if ( superEntityBinding == null ) {
		return makeRootEntityBinding( (RootEntitySource) entitySource );
	}
	else {
		switch ( currentInheritanceType ) {
			case SINGLE_TABLE:
				return makeDiscriminatedSubclassBinding( (SubclassEntitySource) entitySource, superEntityBinding );
			case JOINED:
				return makeJoinedSubclassBinding( (SubclassEntitySource) entitySource, superEntityBinding );
			case TABLE_PER_CLASS:
				return makeUnionedSubclassBinding( (SubclassEntitySource) entitySource, superEntityBinding );
			default:
				// extreme internal error!
				throw new AssertionFailure( "Internal condition failure" );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:Binder.java


示例3: makeRootEntityBinding

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Binder.java


示例4: bindIdentifier

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private void bindIdentifier(RootEntitySource entitySource, EntityBinding entityBinding) {
	if ( entitySource.getIdentifierSource() == null ) {
		throw new AssertionFailure( "Expecting identifier information on root entity descriptor" );
	}
	switch ( entitySource.getIdentifierSource().getNature() ) {
		case SIMPLE: {
			bindSimpleIdentifier( (SimpleIdentifierSource) entitySource.getIdentifierSource(), entityBinding );
			break;
		}
		case AGGREGATED_COMPOSITE: {
			// composite id with an actual component class
		    break;
		}
		case COMPOSITE: {
			// what we used to term an "embedded composite identifier", which is not tobe confused with the JPA
			// term embedded. Specifically a composite id where there is no component class, though there may
			// be a @IdClass :/
		    break;
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Binder.java


示例5: bindDiscriminator

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private void bindDiscriminator(RootEntitySource entitySource, EntityBinding entityBinding) {
	final DiscriminatorSource discriminatorSource = entitySource.getDiscriminatorSource();
	if ( discriminatorSource == null ) {
		return;
	}

	EntityDiscriminator discriminator = new EntityDiscriminator();
	SimpleValue relationalValue = makeSimpleValue(
			entityBinding,
			discriminatorSource.getDiscriminatorRelationalValueSource()
	);
	discriminator.setBoundValue( relationalValue );

	discriminator.getExplicitHibernateTypeDescriptor().setExplicitTypeName(
			discriminatorSource.getExplicitHibernateTypeName() != null
					? discriminatorSource.getExplicitHibernateTypeName()
					: "string"
	);

	discriminator.setInserted( discriminatorSource.isInserted() );
	discriminator.setForced( discriminatorSource.isForced() );

	entityBinding.getHierarchyDetails().setEntityDiscriminator( discriminator );
	entityBinding.setDiscriminatorMatchValue( entitySource.getDiscriminatorMatchValue() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:Binder.java


示例6: createTable

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private Table createTable(EntityBinding entityBinding, TableSource tableSource) {
	String tableName = tableSource.getExplicitTableName();
	if ( StringHelper.isEmpty( tableName ) ) {
		tableName = currentBindingContext.getNamingStrategy()
				.classToTableName( entityBinding.getEntity().getClassName() );
	}
	else {
		tableName = currentBindingContext.getNamingStrategy().tableName( tableName );
	}
	tableName = quoteIdentifier( tableName );

	final Schema.Name databaseSchemaName = Helper.determineDatabaseSchemaName(
			tableSource.getExplicitSchemaName(),
			tableSource.getExplicitCatalogName(),
			currentBindingContext
	);
	return currentBindingContext.getMetadataImplementor()
			.getDatabase()
			.locateSchema( databaseSchemaName )
			.locateOrCreateTable( Identifier.toIdentifier( tableName ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Binder.java


示例7: bindTableUniqueConstraints

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private void bindTableUniqueConstraints(EntitySource entitySource, EntityBinding entityBinding) {
	for ( ConstraintSource constraintSource : entitySource.getConstraints() ) {
		if ( constraintSource instanceof UniqueConstraintSource ) {
			TableSpecification table = entityBinding.locateTable( constraintSource.getTableName() );
			if ( table == null ) {
				// throw exception !?
			}
			String constraintName = constraintSource.name();
			if ( constraintName == null ) {
				// create a default name
			}

			UniqueKey uniqueKey = table.getOrCreateUniqueKey( constraintName );
			for ( String columnName : constraintSource.columnNames() ) {
				uniqueKey.addColumn( table.locateOrCreateColumn( quoteIdentifier( columnName ) ) );
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:Binder.java


示例8: resolve

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
void resolve() {
	for ( EntityBinding entityBinding : metadata.getEntityBindings() ) {
		if ( entityBinding.getHierarchyDetails().getEntityDiscriminator() != null ) {
			resolveDiscriminatorTypeInformation( entityBinding.getHierarchyDetails().getEntityDiscriminator() );
		}
		for ( AttributeBinding attributeBinding : entityBinding.attributeBindings() ) {
			if ( SingularAttributeBinding.class.isInstance( attributeBinding ) ) {
				resolveSingularAttributeTypeInformation(
						SingularAttributeBinding.class.cast( attributeBinding  )
				);
			}
			else if ( AbstractPluralAttributeBinding.class.isInstance( attributeBinding ) ) {
				resolvePluralAttributeTypeInformation(
						AbstractPluralAttributeBinding.class.cast( attributeBinding )
				);
			}
			else {
				throw new AssertionFailure( "Unknown type of AttributeBinding: " + attributeBinding.getClass().getName() );
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:HibernateTypeResolver.java


示例9: getRootEntityBinding

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
@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 );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:MetadataImpl.java


示例10: UnionSubclassEntityPersister

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
public UnionSubclassEntityPersister(
		final EntityBinding entityBinding,
		final EntityRegionAccessStrategy cacheAccessStrategy,
		final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
		final SessionFactoryImplementor factory,
		final Mapping mapping) throws HibernateException {
	super(entityBinding, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
	// TODO: implement!!! initializing final fields to null to make compiler happy.
	subquery = null;
	tableName = null;
	subclassClosure = null;
	spaces = null;
	subclassSpaces = null;
	discriminatorValue = null;
	discriminatorSQLValue = null;
	constraintOrderedTableNames = null;
	constraintOrderedKeyColumnNames = null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:UnionSubclassEntityPersister.java


示例11: buildProxyFactory

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
@Override
protected ProxyFactory buildProxyFactory(EntityBinding mappingInfo, Getter idGetter, Setter idSetter) {

	ProxyFactory pf = new MapProxyFactory();
	try {
		//TODO: design new lifecycle for ProxyFactory
		pf.postInstantiate(
				getEntityName(),
				null,
				null,
				null,
				null,
				null
		);
	}
	catch ( HibernateException he ) {
		LOG.unableToCreateProxyFactory(getEntityName(), he);
		pf = null;
	}
	return pf;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:DynamicMapEntityTuplizer.java


示例12: processEntityHierarchy

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
/**
 * Process an entity hierarchy.
 *
 * @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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Binder.java


示例13: makeDiscriminatedSubclassBinding

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private EntityBinding makeDiscriminatedSubclassBinding(SubclassEntitySource entitySource, EntityBinding superEntityBinding) {
	final EntityBinding entityBinding = buildBasicEntityBinding( entitySource, superEntityBinding );

	entityBinding.setPrimaryTable( superEntityBinding.getPrimaryTable() );
	entityBinding.setPrimaryTableName( superEntityBinding.getPrimaryTableName() );
	bindDiscriminatorValue( entitySource, entityBinding );

	return entityBinding;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Binder.java


示例14: bindSimpleIdentifier

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private void bindSimpleIdentifier(SimpleIdentifierSource identifierSource, EntityBinding entityBinding) {
	final BasicAttributeBinding idAttributeBinding = doBasicSingularAttributeBindingCreation(
			identifierSource.getIdentifierAttributeSource(), entityBinding
	);

	entityBinding.getHierarchyDetails().getEntityIdentifier().setValueBinding( idAttributeBinding );
	IdGenerator generator = identifierSource.getIdentifierGeneratorDescriptor();
	if ( generator == null ) {
		Map<String, String> params = new HashMap<String, String>();
		params.put( IdentifierGenerator.ENTITY_NAME, entityBinding.getEntity().getName() );
		generator = new IdGenerator( "default_assign_identity_generator", "assigned", params );
	}
	entityBinding.getHierarchyDetails()
			.getEntityIdentifier()
			.setIdGenerator( generator );

	final org.hibernate.metamodel.relational.Value relationalValue = idAttributeBinding.getValue();

	if ( SimpleValue.class.isInstance( relationalValue ) ) {
		if ( !Column.class.isInstance( relationalValue ) ) {
			// this should never ever happen..
			throw new AssertionFailure( "Simple-id was not a column." );
		}
		entityBinding.getPrimaryTable().getPrimaryKey().addColumn( Column.class.cast( relationalValue ) );
	}
	else {
		for ( SimpleValue subValue : ( (Tuple) relationalValue ).values() ) {
			if ( Column.class.isInstance( subValue ) ) {
				entityBinding.getPrimaryTable().getPrimaryKey().addColumn( Column.class.cast( subValue ) );
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:Binder.java


示例15: bindVersion

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private void bindVersion(EntityBinding entityBinding, RootEntitySource entitySource) {
	final SingularAttributeSource versioningAttributeSource = entitySource.getVersioningAttributeSource();
	if ( versioningAttributeSource == null ) {
		return;
	}

	BasicAttributeBinding attributeBinding = doBasicSingularAttributeBindingCreation(
			versioningAttributeSource, entityBinding
	);
	entityBinding.getHierarchyDetails().setVersioningAttributeBinding( attributeBinding );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:Binder.java


示例16: bindDiscriminatorValue

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private void bindDiscriminatorValue(SubclassEntitySource entitySource, EntityBinding entityBinding) {
	final String discriminatorValue = entitySource.getDiscriminatorMatchValue();
	if ( discriminatorValue == null ) {
		return;
	}
	entityBinding.setDiscriminatorMatchValue( discriminatorValue );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:Binder.java


示例17: makeSimpleValue

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
private SimpleValue makeSimpleValue(
		EntityBinding entityBinding,
		RelationalValueSource valueSource) {
	final TableSpecification table = entityBinding.locateTable( valueSource.getContainingTableName() );

	if ( ColumnSource.class.isInstance( valueSource ) ) {
		return makeColumn( (ColumnSource) valueSource, table );
	}
	else {
		return makeDerivedValue( (DerivedValueSource) valueSource, table );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:Binder.java


示例18: resolve

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
@SuppressWarnings( {"unchecked"} )
void resolve() {
	for ( EntityBinding entityBinding : metadata.getEntityBindings() ) {
		if ( entityBinding.isRoot() ) {
			Properties properties = new Properties( );
			properties.putAll(
					metadata.getServiceRegistry()
							.getService( ConfigurationService.class )
							.getSettings()
			);
			//TODO: where should these be added???
			if ( ! properties.contains( AvailableSettings.PREFER_POOLED_VALUES_LO ) ) {
				properties.put( AvailableSettings.PREFER_POOLED_VALUES_LO, "false" );
			}
			if ( ! properties.contains( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ) ) {
				properties.put(
						PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
						new ObjectNameNormalizerImpl( metadata )
				);
			}
			entityBinding.getHierarchyDetails().getEntityIdentifier().createIdentifierGenerator(
					metadata.getIdentifierGeneratorFactory(),
					properties
			);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:IdentifierGeneratorResolver.java


示例19: resolve

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
void resolve() {
	for ( EntityBinding entityBinding : metadata.getEntityBindings() ) {
		for ( SingularAssociationAttributeBinding attributeBinding : entityBinding.getEntityReferencingAttributeBindings() ) {
			resolve( attributeBinding );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AssociationResolver.java


示例20: addEntity

import org.hibernate.metamodel.binding.EntityBinding; //导入依赖的package包/类
public void addEntity(EntityBinding entityBinding) {
	final String entityName = entityBinding.getEntity().getName();
	if ( entityBindingMap.containsKey( entityName ) ) {
		throw new DuplicateMappingException( DuplicateMappingException.Type.ENTITY, entityName );
	}
	entityBindingMap.put( entityName, entityBinding );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:MetadataImpl.java



注:本文中的org.hibernate.metamodel.binding.EntityBinding类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultObserver类代码示例发布时间:2022-05-22
下一篇:
Java DiagramColorRegistry类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap