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

Java AssociationType类代码示例

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

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



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

示例1: addAssociationToJoinTreeIfNecessary

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Add on association (one-to-one, many-to-one, or a collection) to a list 
 * of associations to be fetched by outerjoin (if necessary)
 */
private void addAssociationToJoinTreeIfNecessary(
		final AssociationType type,
		final String[] aliasedLhsColumns,
		final String alias,
		final PropertyPath path,
		int currentDepth,
		final JoinType joinType) throws MappingException {
	if ( joinType != JoinType.NONE ) {
		addAssociationToJoinTree(
				type, 
				aliasedLhsColumns, 
				alias, 
				path,
				currentDepth,
				joinType
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:JoinWalker.java


示例2: getJoinType

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Determine the appropriate type of join (if any) to use to fetch the
 * given association.
 *
 * @param persister The owner of the association.
 * @param path The path to the association
 * @param propertyNumber The property number representing the association.
 * @param associationType The association type.
 * @param metadataFetchMode The metadata-defined fetch mode.
 * @param metadataCascadeStyle The metadata-defined cascade style.
 * @param lhsTable The owner table
 * @param lhsColumns The owner join columns
 * @param nullable Is the association nullable.
 * @param currentDepth Current join depth
 * @return type of join to use ({@link org.hibernate.sql.JoinType#INNER_JOIN},
 * {@link org.hibernate.sql.JoinType#LEFT_OUTER_JOIN}, or -1 to indicate no joining.
 * @throws MappingException ??
 */
protected JoinType getJoinType(
		OuterJoinLoadable persister,
		final PropertyPath path,
		int propertyNumber,
		AssociationType associationType,
		FetchMode metadataFetchMode,
		CascadeStyle metadataCascadeStyle,
		String lhsTable,
		String[] lhsColumns,
		final boolean nullable,
		final int currentDepth) throws MappingException {
	return getJoinType(
			associationType,
			metadataFetchMode,
			path,
			lhsTable,
			lhsColumns,
			nullable,
			currentDepth,
			metadataCascadeStyle
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:JoinWalker.java


示例3: isJoinedFetchEnabledInMapping

import org.hibernate.type.AssociationType; //导入依赖的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: isJoinable

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Should we join this association?
 */
protected boolean isJoinable(
		final JoinType joinType,
		final Set visitedAssociationKeys,
		final String lhsTable,
		final String[] lhsColumnNames,
		final AssociationType type,
		final int depth) {

	if ( joinType == JoinType.NONE ) {
		return false;
	}
	
	if ( joinType == JoinType.INNER_JOIN ) {
		return true;
	}

	Integer maxFetchDepth = getFactory().getSettings().getMaximumFetchDepth();
	final boolean tooDeep = maxFetchDepth!=null && depth >= maxFetchDepth;
	
	return !tooDeep && !isDuplicateAssociation(lhsTable, lhsColumnNames, type);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JoinWalker.java


示例5: getJoinType

import org.hibernate.type.AssociationType; //导入依赖的package包/类
@Override
protected JoinType getJoinType(
		AssociationType associationType,
		FetchMode config,
		PropertyPath path,
		String lhsTable,
		String[] lhsColumns,
		boolean nullable,
		int currentDepth,
		CascadeStyle cascadeStyle) throws MappingException {
	return getJoinType(
			null,
			path,
			-1,
			associationType,
			config,
			cascadeStyle,
			lhsTable,
			lhsColumns,
			nullable,
			currentDepth
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:CriteriaJoinWalker.java


示例6: createRoot

import org.hibernate.type.AssociationType; //导入依赖的package包/类
public static OuterJoinableAssociation createRoot(
		AssociationType joinableType,
		String alias,
		SessionFactoryImplementor factory) {
	return new OuterJoinableAssociation(
			new PropertyPath(),
			joinableType,
			null,
			null,
			alias,
			JoinType.LEFT_OUTER_JOIN,
			null,
			false,
			factory,
			Collections.EMPTY_MAP
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:OuterJoinableAssociation.java


示例7: OuterJoinableAssociation

import org.hibernate.type.AssociationType; //导入依赖的package包/类
public OuterJoinableAssociation(
		PropertyPath propertyPath,
		AssociationType joinableType,
		String lhsAlias,
		String[] lhsColumns,
		String rhsAlias,
		JoinType joinType,
		String withClause,
		boolean hasRestriction,
		SessionFactoryImplementor factory,
		Map enabledFilters) throws MappingException {
	this.propertyPath = propertyPath;
	this.joinableType = joinableType;
	this.lhsAlias = lhsAlias;
	this.lhsColumns = lhsColumns;
	this.rhsAlias = rhsAlias;
	this.joinType = joinType;
	this.joinable = joinableType.getAssociatedJoinable(factory);
	this.rhsColumns = JoinHelper.getRHSColumnNames(joinableType, factory);
	this.on = joinableType.getOnCondition(rhsAlias, factory, enabledFilters)
		+ ( withClause == null || withClause.trim().length() == 0 ? "" : " and ( " + withClause + " )" );
	this.hasRestriction = hasRestriction;
	this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:OuterJoinableAssociation.java


示例8: resolveAdditionalJoinCondition

import org.hibernate.type.AssociationType; //导入依赖的package包/类
private String resolveAdditionalJoinCondition(String rhsTableAlias, String withClause, Joinable joinable, AssociationType associationType) {
	// turns out that the call to AssociationType#getOnCondition in the initial code really just translates to
	// calls to the Joinable.filterFragment() method where the Joinable is either the entity or
	// collection persister
	final String filter = associationType!=null?
			associationType.getOnCondition( rhsTableAlias, factory, buildingParameters.getQueryInfluencers().getEnabledFilters() ):
			joinable.filterFragment(
				rhsTableAlias,
				buildingParameters.getQueryInfluencers().getEnabledFilters()
	);

	if ( StringHelper.isEmpty( withClause ) && StringHelper.isEmpty( filter ) ) {
		return "";
	}
	else if ( StringHelper.isNotEmpty( withClause ) && StringHelper.isNotEmpty( filter ) ) {
		return filter + " and " + withClause;
	}
	else {
		// only one is non-empty...
		return StringHelper.isNotEmpty( filter ) ? filter : withClause;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:LoadQueryJoinAndFetchProcessor.java


示例9: getSubclassPropertyTableNumber

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Warning:
 * When there are duplicated property names in the subclasses
 * of the class, this method may return the wrong table
 * number for the duplicated subclass property (note that
 * SingleTableEntityPersister defines an overloaded form
 * which takes the entity name.
 */
public int getSubclassPropertyTableNumber(String propertyPath) {
	String rootPropertyName = StringHelper.root(propertyPath);
	Type type = propertyMapping.toType(rootPropertyName);
	if ( type.isAssociationType() ) {
		AssociationType assocType = ( AssociationType ) type;
		if ( assocType.useLHSPrimaryKey() ) {
			// performance op to avoid the array search
			return 0;
		}
		else if ( type.isCollectionType() ) {
			// properly handle property-ref-based associations
			rootPropertyName = assocType.getLHSPropertyName();
		}
	}
	//Enable for HHH-440, which we don't like:
	/*if ( type.isComponentType() && !propertyName.equals(rootPropertyName) ) {
		String unrooted = StringHelper.unroot(propertyName);
		int idx = ArrayHelper.indexOf( getSubclassColumnClosure(), unrooted );
		if ( idx != -1 ) {
			return getSubclassColumnTableNumberClosure()[idx];
		}
	}*/
	int index = ArrayHelper.indexOf( getSubclassPropertyNameClosure(), rootPropertyName); //TODO: optimize this better!
	return index==-1 ? 0 : getSubclassPropertyTableNumber(index);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:AbstractEntityPersister.java


示例10: selectFragment

import org.hibernate.type.AssociationType; //导入依赖的package包/类
public String selectFragment(
        Joinable rhs,
        String rhsAlias,
        String lhsAlias,
        String entitySuffix,
        String collectionSuffix,
        boolean includeCollectionColumns) {
	// we need to determine the best way to know that two joinables
	// represent a single many-to-many...
	if ( rhs != null && isManyToMany() && !rhs.isCollection() ) {
		AssociationType elementType = ( ( AssociationType ) getElementType() );
		if ( rhs.equals( elementType.getAssociatedJoinable( getFactory() ) ) ) {
			return manyToManySelectFragment( rhs, rhsAlias, lhsAlias, collectionSuffix );
		}
	}
	return includeCollectionColumns ? selectFragment( lhsAlias, collectionSuffix ) : "";
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:BasicCollectionPersister.java


示例11: determineFetchTiming

import org.hibernate.type.AssociationType; //导入依赖的package包/类
public static FetchTiming determineFetchTiming(
		FetchStyle style,
		AssociationType type,
		SessionFactoryImplementor sessionFactory) {
	switch ( style ) {
		case JOIN: {
			return FetchTiming.IMMEDIATE;
		}
		case BATCH:
		case SUBSELECT: {
			return FetchTiming.DELAYED;
		}
		default: {
			// SELECT case, can be either
			return isSubsequentSelectDelayed( type, sessionFactory )
					? FetchTiming.DELAYED
					: FetchTiming.IMMEDIATE;
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:FetchStrategyHelper.java


示例12: decode

import org.hibernate.type.AssociationType; //导入依赖的package包/类
private static NonIdentifierAttributeNature decode(Type type) {
	if ( type.isAssociationType() ) {
		AssociationType associationType = (AssociationType) type;

		if ( type.isComponentType() ) {
			// an any type is both an association and a composite...
			return NonIdentifierAttributeNature.ANY;
		}

		return type.isCollectionType()
				? NonIdentifierAttributeNature.COLLECTION
				: NonIdentifierAttributeNature.ENTITY;
	}
	else {
		if ( type.isComponentType() ) {
			return NonIdentifierAttributeNature.COMPOSITE;
		}

		return NonIdentifierAttributeNature.BASIC;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PropertyFactory.java


示例13: getAliasedLHSColumnNames

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Get the qualified (prefixed by alias) names of the columns of the owning entity which are to be used in the join
 *
 * @param associationType The association type for the association that represents the join
 * @param columnQualifier The left-hand side table alias
 * @param propertyIndex The index of the property that represents the association/join
 * @param begin The index for any nested (composites) attributes
 * @param lhsPersister The persister for the left-hand side of the association/join
 * @param mapping The mapping (typically the SessionFactory).
 *
 * @return The qualified column names.
 */
public static String[] getAliasedLHSColumnNames(
		AssociationType associationType,
		String columnQualifier,
		int propertyIndex,
		int begin,
		OuterJoinLoadable lhsPersister,
		Mapping mapping) {
	if ( associationType.useLHSPrimaryKey() ) {
		return StringHelper.qualify( columnQualifier, lhsPersister.getIdentifierColumnNames() );
	}
	else {
		final String propertyName = associationType.getLHSPropertyName();
		if ( propertyName == null ) {
			return ArrayHelper.slice(
					toColumns( lhsPersister, columnQualifier, propertyIndex ),
					begin,
					associationType.getColumnSpan( mapping )
			);
		}
		else {
			//bad cast
			return ( (PropertyMapping) lhsPersister ).toColumns( columnQualifier, propertyName );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:JoinHelper.java


示例14: addAssociationToJoinTreeIfNecessary

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Add on association (one-to-one, many-to-one, or a collection) to a list 
 * of associations to be fetched by outerjoin (if necessary)
 */
private void addAssociationToJoinTreeIfNecessary(
	final AssociationType type,
	final String[] aliasedLhsColumns,
	final String alias,
	final String path,
	int currentDepth,
	final int joinType)
throws MappingException {
	
	if (joinType>=0) {	
		addAssociationToJoinTree(
				type, 
				aliasedLhsColumns, 
				alias, 
				path,
				currentDepth,
				joinType
			);
	}

}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:26,代码来源:JoinWalker.java


示例15: getJoinType

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Get the join type (inner, outer, etc) or -1 if the
 * association should not be joined. Override on
 * subclasses.
 */
protected int getJoinType(
		AssociationType type, 
		FetchMode config, 
		String path, 
		String lhsTable,
		String[] lhsColumns,
		boolean nullable,
		int currentDepth, 
		CascadeStyle cascadeStyle)
throws MappingException {
	
	if  ( !isJoinedFetchEnabled(type, config, cascadeStyle) ) return -1;
	
	if ( isTooDeep(currentDepth) || ( type.isCollectionType() && isTooManyCollections() ) ) return -1;
	
	final boolean dupe = isDuplicateAssociation(lhsTable,  lhsColumns, type);
	if (dupe) return -1;
	
	return getJoinType(nullable, currentDepth);
	
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:27,代码来源:JoinWalker.java


示例16: isDuplicateAssociation

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Used to detect circularities in the joined graph, note that 
 * this method is side-effecty
 */
protected boolean isDuplicateAssociation(
	final String lhsTable,
	final String[] lhsColumnNames,
	final AssociationType type
) {
	final String foreignKeyTable;
	final String[] foreignKeyColumns;
	if ( type.getForeignKeyDirection()==ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT ) {
		foreignKeyTable = lhsTable;
		foreignKeyColumns = lhsColumnNames;
	}
	else {
		foreignKeyTable = type.getAssociatedJoinable( getFactory() ).getTableName();
		foreignKeyColumns = JoinHelper.getRHSColumnNames( type, getFactory() );
	}
	return isDuplicateAssociation(foreignKeyTable, foreignKeyColumns);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:JoinWalker.java


示例17: isJoinable

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Should we join this association?
 */
protected boolean isJoinable(
	final int joinType,
	final Set visitedAssociationKeys, 
	final String lhsTable,
	final String[] lhsColumnNames,
	final AssociationType type,
	final int depth
) {
	if (joinType<0) return false;
	
	if (joinType==JoinFragment.INNER_JOIN) return true;
	
	Integer maxFetchDepth = getFactory().getSettings().getMaximumFetchDepth();
	final boolean tooDeep = maxFetchDepth!=null && 
		depth >= maxFetchDepth.intValue();
	
	return !tooDeep && !isDuplicateAssociation(lhsTable, lhsColumnNames, type);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:JoinWalker.java


示例18: OuterJoinableAssociation

import org.hibernate.type.AssociationType; //导入依赖的package包/类
public OuterJoinableAssociation(
	AssociationType joinableType,
	String lhsAlias,
	String[] lhsColumns,
	String rhsAlias,
	int joinType,
	SessionFactoryImplementor factory,
	Map enabledFilters)
throws MappingException {
	this.joinableType = joinableType;
	this.lhsAlias = lhsAlias;
	this.lhsColumns = lhsColumns;
	this.rhsAlias = rhsAlias;
	this.joinType = joinType;
	this.joinable = joinableType.getAssociatedJoinable(factory);
	this.rhsColumns = JoinHelper.getRHSColumnNames(joinableType, factory);
	this.on = joinableType.getOnCondition(rhsAlias, factory, enabledFilters);
	this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:20,代码来源:OuterJoinableAssociation.java


示例19: cascadeProperty

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Cascade an action to the child or children
 */
private void cascadeProperty(
		final Object child,
		final Type type,
		final CascadeStyle style,
		final Object anything,
		final boolean isCascadeDeleteEnabled) throws HibernateException {

	if (child!=null) {
		if ( type.isAssociationType() ) {
			AssociationType associationType = (AssociationType) type;
			if ( cascadeAssociationNow( associationType ) ) {
				cascadeAssociation(
						child,
						type,
						style,
						anything,
						isCascadeDeleteEnabled
					);
			}
		}
		else if ( type.isComponentType() ) {
			cascadeComponent( child, (AbstractComponentType) type, anything );
		}
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:29,代码来源:Cascade.java


示例20: getAliasedLHSColumnNames

import org.hibernate.type.AssociationType; //导入依赖的package包/类
/**
 * Get the aliased columns of the owning entity which are to 
 * be used in the join
 */
public static String[] getAliasedLHSColumnNames(
		AssociationType type, 
		String alias, 
		int property, 
		int begin, 
		OuterJoinLoadable lhsPersister,
		Mapping mapping
) {
	if ( type.useLHSPrimaryKey() ) {
		return StringHelper.qualify( alias, lhsPersister.getIdentifierColumnNames() );
	}
	else {
		String propertyName = type.getLHSPropertyName();
		if (propertyName==null) {
			return ArrayHelper.slice( 
					lhsPersister.toColumns(alias, property), 
					begin, 
					type.getColumnSpan(mapping) 
				);
		}
		else {
			return ( (PropertyMapping) lhsPersister ).toColumns(alias, propertyName); //bad cast
		}
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:30,代码来源:JoinHelper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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