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

Java EntityType类代码示例

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

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



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

示例1: findKeyManyToOneTargetIndices

import org.hibernate.type.EntityType; //导入依赖的package包/类
private void findKeyManyToOneTargetIndices(
		ArrayList<Integer> keyManyToOneTargetIndices,
		OuterJoinableAssociation joinWithCompositeId,
		CompositeType componentType) {
	for ( Type subType : componentType.getSubtypes() ) {
		if ( subType.isEntityType() ) {
			Integer index = locateKeyManyToOneTargetIndex( joinWithCompositeId, (EntityType) subType );
			if ( index != null ) {
				keyManyToOneTargetIndices.add( index );
			}
		}
		else if ( subType.isComponentType() ) {
			findKeyManyToOneTargetIndices(
					keyManyToOneTargetIndices,
					joinWithCompositeId,
					(CompositeType) subType
			);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:EntityJoinWalker.java


示例2: locateKeyManyToOneTargetIndex

import org.hibernate.type.EntityType; //导入依赖的package包/类
private Integer locateKeyManyToOneTargetIndex(OuterJoinableAssociation joinWithCompositeId, EntityType keyManyToOneType) {
	// the lhs (if one) is a likely candidate
	if ( joinWithCompositeId.getLhsAlias() != null ) {
		final OuterJoinableAssociation lhs = associationsByAlias.get( joinWithCompositeId.getLhsAlias() );
		if ( keyManyToOneType.getAssociatedEntityName( factory ).equals( lhs.getJoinableType().getAssociatedEntityName( factory ) ) ) {
			return positionsByAlias.get( lhs.getRhsAlias() );
		}
	}
	// otherwise, seek out OuterJoinableAssociation which are RHS of given OuterJoinableAssociation
	// (joinWithCompositeId)
	for ( OuterJoinableAssociation oja : associationsByAlias.values() ) {
		if ( oja.getLhsAlias() != null && oja.getLhsAlias().equals( joinWithCompositeId.getRhsAlias() ) ) {
			if ( keyManyToOneType.equals( oja.getJoinableType() ) ) {
				return positionsByAlias.get( oja.getLhsAlias() );
			}
		}
	}
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:EntityJoinWalker.java


示例3: isJoinedFetchEnabledInMapping

import org.hibernate.type.EntityType; //导入依赖的package包/类
/**
 * Does the mapping, and Hibernate default semantics, specify that
 * this association should be fetched by outer joining
 */
protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type) 
throws MappingException {
	if ( !type.isEntityType() && !type.isCollectionType() ) {
		return false;
	}
	else {
		if (config==FetchMode.JOIN) return true;
		if (config==FetchMode.SELECT) return false;
		if ( type.isEntityType() ) {
			//TODO: look at the owning property and check that it 
			//      isn't lazy (by instrumentation)
			EntityType entityType =(EntityType) type;
			EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() );
			return !persister.hasProxy();
		}
		else {
			return false;
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JoinWalker.java


示例4: registerNonExists

import org.hibernate.type.EntityType; //导入依赖的package包/类
private void registerNonExists(EntityFetch fetch) {
	final EntityType fetchedType = fetch.getFetchedType();
	if ( ! fetchedType.isOneToOne() ) {
		return;
	}

	final EntityReferenceProcessingState fetchOwnerState = getOwnerProcessingState( fetch );
	if ( fetchOwnerState == null ) {
		throw new IllegalStateException( "Could not locate fetch owner state" );
	}

	final EntityKey ownerEntityKey = fetchOwnerState.getEntityKey();
	if ( ownerEntityKey == null ) {
		throw new IllegalStateException( "Could not locate fetch owner EntityKey" );
	}

	session.getPersistenceContext().addNullProperty(
			ownerEntityKey,
			fetchedType.getPropertyName()
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:ResultSetProcessingContextImpl.java


示例5: handleMissingIdentifier

import org.hibernate.type.EntityType; //导入依赖的package包/类
private void handleMissingIdentifier(ResultSetProcessingContext context) {
	if ( EntityFetch.class.isInstance( entityReference ) ) {
		final EntityFetch fetch = (EntityFetch) entityReference;
		final EntityType fetchedType = fetch.getFetchedType();
		if ( ! fetchedType.isOneToOne() ) {
			return;
		}

		final EntityReferenceProcessingState fetchOwnerState = context.getOwnerProcessingState( fetch );
		if ( fetchOwnerState == null ) {
			throw new IllegalStateException( "Could not locate fetch owner state" );
		}

		final EntityKey ownerEntityKey = fetchOwnerState.getEntityKey();
		if ( ownerEntityKey != null ) {
			context.getSession().getPersistenceContext().addNullProperty(
					ownerEntityKey,
					fetchedType.getPropertyName()
			);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:EntityReferenceInitializerImpl.java


示例6: createCollectionElementAliases

import org.hibernate.type.EntityType; //导入依赖的package包/类
private EntityReferenceAliases createCollectionElementAliases(
		CollectionPersister collectionPersister,
		String tableAlias,
		String elementQuerySpaceUid) {

	if ( !collectionPersister.getElementType().isEntityType() ) {
		return null;
	}
	else {
		final EntityType entityElementType = (EntityType) collectionPersister.getElementType();
		return generateEntityReferenceAliases(
				elementQuerySpaceUid,
				tableAlias,
				(EntityPersister) entityElementType.getAssociatedJoinable( sessionFactory() )
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AliasResolutionContextImpl.java


示例7: createEntityJoin

import org.hibernate.type.EntityType; //导入依赖的package包/类
public JoinDefinedByMetadata createEntityJoin(
		QuerySpace leftHandSide,
		String lhsPropertyName,
		EntityQuerySpace rightHandSide,
		boolean rightHandSideRequired,
		EntityType joinedPropertyType,
		SessionFactoryImplementor sessionFactory) {
	return new JoinImpl(
			leftHandSide,
			lhsPropertyName,
			rightHandSide,
			determineRhsColumnNames( joinedPropertyType, sessionFactory ),
			joinedPropertyType,
			rightHandSideRequired
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:JoinHelper.java


示例8: buildBidirectionalEntityReference

import org.hibernate.type.EntityType; //导入依赖的package包/类
@Override
public BidirectionalEntityReference buildBidirectionalEntityReference(
		AssociationAttributeDefinition attributeDefinition,
		FetchStrategy fetchStrategy,
		EntityReference targetEntityReference) {
	final EntityType fetchedType = (EntityType) attributeDefinition.getType();
	final EntityPersister fetchedPersister = attributeDefinition.toEntityDefinition().getEntityPersister();

	if ( fetchedPersister == null ) {
		throw new WalkingException(
				String.format(
						"Unable to locate EntityPersister [%s] for bidirectional entity reference [%s]",
						fetchedType.getAssociatedEntityName(),
						attributeDefinition.getName()
				)
		);
	}

	final BidirectionalEntityReference bidirectionalEntityReference =
			new BidirectionalEntityReferenceImpl( this, attributeDefinition, targetEntityReference );
	addBidirectionalEntityReference( bidirectionalEntityReference );
	return bidirectionalEntityReference;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AbstractExpandingFetchSource.java


示例9: createUniqueKeyLoader

import org.hibernate.type.EntityType; //导入依赖的package包/类
private EntityLoader createUniqueKeyLoader(
		Type uniqueKeyType,
		String[] columns,
		LoadQueryInfluencers loadQueryInfluencers) {
	if ( uniqueKeyType.isEntityType() ) {
		String className = ( ( EntityType ) uniqueKeyType ).getAssociatedEntityName();
		uniqueKeyType = getFactory().getEntityPersister( className ).getIdentifierType();
	}
	return new EntityLoader(
			this,
			columns,
			uniqueKeyType,
			1,
			LockMode.NONE,
			getFactory(),
			loadQueryInfluencers
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AbstractEntityPersister.java


示例10: initIdentifierPropertyPaths

import org.hibernate.type.EntityType; //导入依赖的package包/类
protected void initIdentifierPropertyPaths(
		final String path,
		final EntityType etype,
		final String[] columns,
		final String[] columnReaders,
		final String[] columnReaderTemplates,
		final Mapping factory) throws MappingException {

	Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
	String idPropName = etype.getIdentifierOrUniqueKeyPropertyName(factory);
	boolean hasNonIdentifierPropertyNamedId = hasNonIdentifierPropertyNamedId( etype, factory );

	if ( etype.isReferenceToPrimaryKey() ) {
		if ( !hasNonIdentifierPropertyNamedId ) {
			String idpath1 = extendPath(path, EntityPersister.ENTITY_ID);
			addPropertyPath(idpath1, idtype, columns, columnReaders, columnReaderTemplates, null);
			initPropertyPaths(idpath1, idtype, columns, columnReaders, columnReaderTemplates, null, factory);
		}
	}

	if (idPropName!=null) {
		String idpath2 = extendPath(path, idPropName);
		addPropertyPath(idpath2, idtype, columns, columnReaders, columnReaderTemplates, null);
		initPropertyPaths(idpath2, idtype, columns, columnReaders, columnReaderTemplates, null, factory);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:AbstractPropertyMapping.java


示例11: cascadeToOne

import org.hibernate.type.EntityType; //导入依赖的package包/类
/**
 * Cascade an action to a to-one association or any type
 */
private void cascadeToOne(
		final Object parent,
		final Object child,
		final Type type,
		final CascadeStyle style,
		final Object anything,
		final boolean isCascadeDeleteEnabled) {
	final String entityName = type.isEntityType()
			? ( (EntityType) type ).getAssociatedEntityName()
			: null;
	if ( style.reallyDoCascade( action ) ) {
		//not really necessary, but good for consistency...
		eventSource.getPersistenceContext().addChildParent( child, parent );
		try {
			action.cascade( eventSource, child, entityName, anything, isCascadeDeleteEnabled );
		}
		finally {
			eventSource.getPersistenceContext().removeChildParent( child );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:Cascade.java


示例12: remove

import org.hibernate.type.EntityType; //导入依赖的package包/类
public void remove() {
	if (!single) {
		throw new UnsupportedOperationException("Not a single column hibernate query result set");
	}
	if (currentResult==null) {
		throw new IllegalStateException("Called Iterator.remove() before next()");
	}
	if ( !( types[0] instanceof EntityType ) ) {
		throw new UnsupportedOperationException("Not an entity");
	}

	session.delete(
			( (EntityType) types[0] ).getAssociatedEntityName(),
			currentResult,
			false,
	        null
		);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:IteratorImpl.java


示例13: processValue

import org.hibernate.type.EntityType; //导入依赖的package包/类
/**
 * Visit a property value. Dispatch to the
 * correct handler for the property type.
 * @param value
 * @param type
 * @throws HibernateException
 */
final Object processValue(Object value, Type type) throws HibernateException {

	if ( type.isCollectionType() ) {
		//even process null collections
		return processCollection( value, (CollectionType) type );
	}
	else if ( type.isEntityType() ) {
		return processEntity( value, (EntityType) type );
	}
	else if ( type.isComponentType() ) {
		return processComponent( value, (CompositeType) type );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AbstractVisitor.java


示例14: isReferenceToPrimaryKey

import org.hibernate.type.EntityType; //导入依赖的package包/类
/**
 * Is the given property name a reference to the primary key of the associated
 * entity construed by the given entity type?
 * <p/>
 * For example, consider a fragment like order.customer.id
 * (where order is a from-element alias).  Here, we'd have:
 * propertyName = "id" AND
 * owningType = ManyToOneType(Customer)
 * and are being asked to determine whether "customer.id" is a reference
 * to customer's PK...
 *
 * @param propertyName The name of the property to check.
 * @param owningType The type represeting the entity "owning" the property
 *
 * @return True if propertyName references the entity's (owningType->associatedEntity)
 *         primary key; false otherwise.
 */
private boolean isReferenceToPrimaryKey(String propertyName, EntityType owningType) {
	EntityPersister persister = getSessionFactoryHelper()
			.getFactory()
			.getEntityPersister( owningType.getAssociatedEntityName() );
	if ( persister.getEntityMetamodel().hasNonIdentifierPropertyNamedId() ) {
		// only the identifier property field name can be a reference to the associated entity's PK...
		return propertyName.equals( persister.getIdentifierPropertyName() ) && owningType.isReferenceToPrimaryKey();
	}
	// here, we have two possibilities:
	// 1) the property-name matches the explicitly identifier property name
	// 2) the property-name matches the implicit 'id' property name
	// the referenced node text is the special 'id'
	if ( EntityPersister.ENTITY_ID.equals( propertyName ) ) {
		return owningType.isReferenceToPrimaryKey();
	}
	String keyPropertyName = getSessionFactoryHelper().getIdentifierOrUniqueKeyPropertyName( owningType );
	return keyPropertyName != null && keyPropertyName.equals( propertyName ) && owningType.isReferenceToPrimaryKey();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:DotNode.java


示例15: addFromElement

import org.hibernate.type.EntityType; //导入依赖的package包/类
FromElement addFromElement() throws SemanticException {
	final FromClause parentFromClause = fromClause.getParentFromClause();
	if ( parentFromClause != null ) {
		// Look up class name using the first identifier in the path.
		final String pathAlias = PathHelper.getAlias( path );
		final FromElement parentFromElement = parentFromClause.getFromElement( pathAlias );
		if ( parentFromElement != null ) {
			return createFromElementInSubselect( path, pathAlias, parentFromElement, classAlias );
		}
	}

	final EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister( path );

	final FromElement elem = createAndAddFromElement(
			path,
			classAlias,
			entityPersister,
			(EntityType) ( (Queryable) entityPersister ).getType(),
			null
	);

	// Add to the query spaces.
	fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() );

	return elem;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:FromElementFactory.java


示例16: createJoin

import org.hibernate.type.EntityType; //导入依赖的package包/类
private FromElement createJoin(
		String entityClass,
		String tableAlias,
		JoinSequence joinSequence,
		EntityType type,
		boolean manyToMany) throws SemanticException {
	//  origin, path, implied, columns, classAlias,
	EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister( entityClass );
	FromElement destination = createAndAddFromElement(
			entityClass,
			classAlias,
			entityPersister,
			type,
			tableAlias
	);
	return initializeJoin( path, destination, joinSequence, getColumns(), origin, manyToMany );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:FromElementFactory.java


示例17: determineKeySelectExpressions

import org.hibernate.type.EntityType; //导入依赖的package包/类
private void determineKeySelectExpressions(QueryableCollection collectionPersister, List selections) {
	AliasGenerator aliasGenerator = new LocalAliasGenerator( 0 );
	appendSelectExpressions( collectionPersister.getIndexColumnNames(), selections, aliasGenerator );
	Type keyType = collectionPersister.getIndexType();
	if ( keyType.isAssociationType() ) {
		EntityType entityType = (EntityType) keyType;
		Queryable keyEntityPersister = (Queryable) sfi().getEntityPersister(
				entityType.getAssociatedEntityName( sfi() )
		);
		SelectFragment fragment = keyEntityPersister.propertySelectFragmentFragment(
				collectionTableAlias(),
				null,
				false
		);
		appendSelectExpressions( fragment, selections, aliasGenerator );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:MapEntryNode.java


示例18: determineValueSelectExpressions

import org.hibernate.type.EntityType; //导入依赖的package包/类
private void determineValueSelectExpressions(QueryableCollection collectionPersister, List selections) {
	AliasGenerator aliasGenerator = new LocalAliasGenerator( 1 );
	appendSelectExpressions( collectionPersister.getElementColumnNames(), selections, aliasGenerator );
	Type valueType = collectionPersister.getElementType();
	if ( valueType.isAssociationType() ) {
		EntityType valueEntityType = (EntityType) valueType;
		Queryable valueEntityPersister = (Queryable) sfi().getEntityPersister(
				valueEntityType.getAssociatedEntityName( sfi() )
		);
		SelectFragment fragment = valueEntityPersister.propertySelectFragmentFragment(
				elementTableAlias(),
				null,
				false
		);
		appendSelectExpressions( fragment, selections, aliasGenerator );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:MapEntryNode.java


示例19: getElementName

import org.hibernate.type.EntityType; //导入依赖的package包/类
private String getElementName(PathExpressionParser.CollectionElement element, QueryTranslatorImpl q) throws QueryException {
	String name;
	if ( element.isOneToMany ) {
		name = element.alias;
	}
	else {
		Type type = element.elementType;
		if ( type.isEntityType() ) { //ie. a many-to-many
			String entityName = ( ( EntityType ) type ).getAssociatedEntityName();
			name = pathExpressionParser.continueFromManyToMany( entityName, element.elementColumns, q );
		}
		else {
			throw new QueryException( "illegally dereferenced collection element" );
		}
	}
	return name;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:WhereParser.java


示例20: initIdentifierPropertyPaths

import org.hibernate.type.EntityType; //导入依赖的package包/类
protected void initIdentifierPropertyPaths(
		final String path, 
		final EntityType etype, 
		final String[] columns, 
		final Mapping factory) throws MappingException {

	Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
	String idPropName = etype.getIdentifierOrUniqueKeyPropertyName(factory);
	boolean hasNonIdentifierPropertyNamedId = hasNonIdentifierPropertyNamedId( etype, factory );

	if ( etype.isReferenceToPrimaryKey() ) {
		if ( !hasNonIdentifierPropertyNamedId ) {
			String idpath1 = extendPath(path, EntityPersister.ENTITY_ID);
			addPropertyPath(idpath1, idtype, columns, null);
			initPropertyPaths(idpath1, idtype, columns, null, factory);
		}
	}

	if (idPropName!=null) {
		String idpath2 = extendPath(path, idPropName);
		addPropertyPath(idpath2, idtype, columns, null);
		initPropertyPaths(idpath2, idtype, columns, null, factory);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:25,代码来源:AbstractPropertyMapping.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Encoder类代码示例发布时间:2022-05-22
下一篇:
Java Times类代码示例发布时间: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