当前位置: 首页>>代码示例>>Java>>正文


Java Joinable类代码示例

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


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

示例1: renderEntityJoin

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
private void renderEntityJoin(Join join, JoinFragment joinFragment) {
	final EntityQuerySpace rightHandSide = (EntityQuerySpace) join.getRightHandSide();

	// see if there is already aliases registered for this entity query space (collection joins)
	EntityReferenceAliases aliases = aliasResolutionContext.resolveEntityReferenceAliases( rightHandSide.getUid() );
	if ( aliases == null ) {
		aliasResolutionContext.generateEntityReferenceAliases(
				rightHandSide.getUid(),
				rightHandSide.getEntityPersister()
		);
	}

	final Joinable joinable = (Joinable) rightHandSide.getEntityPersister();
	addJoins(
			join,
			joinFragment,
			joinable
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:LoadQueryJoinAndFetchProcessor.java

示例2: resolveAdditionalJoinCondition

import org.hibernate.persister.entity.Joinable; //导入依赖的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

示例3: selectFragment

import org.hibernate.persister.entity.Joinable; //导入依赖的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

示例4: selectFragment

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
public String selectFragment(
	        Joinable rhs,
	        String rhsAlias,
	        String lhsAlias,
	        String entitySuffix,
	        String collectionSuffix,
	        boolean includeCollectionColumns) {
		StringBuilder buf = new StringBuilder();
		if ( includeCollectionColumns ) {
//			buf.append( selectFragment( lhsAlias, "" ) )//ignore suffix for collection columns!
			buf.append( selectFragment( lhsAlias, collectionSuffix ) )
					.append( ", " );
		}
		OuterJoinLoadable ojl = ( OuterJoinLoadable ) getElementPersister();
		return buf.append( ojl.selectFragment( lhsAlias, entitySuffix ) )//use suffix for the entity columns
				.toString();
	}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:OneToManyPersister.java

示例5: selectFragment

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
public String selectFragment(
	        Joinable rhs,
	        String rhsAlias,
	        String lhsAlias,
	        String entitySuffix,
	        String collectionSuffix,
	        boolean includeCollectionColumns) {
		StringBuffer buf = new StringBuffer();
		if ( includeCollectionColumns ) {
//			buf.append( selectFragment( lhsAlias, "" ) )//ignore suffix for collection columns!
			buf.append( selectFragment( lhsAlias, collectionSuffix ) )
					.append( ", " );
		}
		OuterJoinLoadable ojl = ( OuterJoinLoadable ) getElementPersister();
		return buf.append( ojl.selectFragment( lhsAlias, entitySuffix ) )//use suffix for the entity columns
				.toString();
	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:18,代码来源:OneToManyPersister.java

示例6: selectString

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
/**
 * Generate a select list of columns containing all properties of the entity classes
 */
protected final String selectString(List associations)
throws MappingException {

	if ( associations.size()==0 ) {
		return "";
	}
	else {
		StringBuilder buf = new StringBuilder( associations.size() * 100 );
		int entityAliasCount=0;
		int collectionAliasCount=0;
		for ( int i=0; i<associations.size(); i++ ) {
			OuterJoinableAssociation join = (OuterJoinableAssociation) associations.get(i);
			OuterJoinableAssociation next = (i == associations.size() - 1)
			        ? null
			        : ( OuterJoinableAssociation ) associations.get( i + 1 );
			final Joinable joinable = join.getJoinable();
			final String entitySuffix = ( suffixes == null || entityAliasCount >= suffixes.length )
			        ? null
			        : suffixes[entityAliasCount];
			final String collectionSuffix = ( collectionSuffixes == null || collectionAliasCount >= collectionSuffixes.length )
			        ? null
			        : collectionSuffixes[collectionAliasCount];
			final String selectFragment = joinable.selectFragment(
					next == null ? null : next.getJoinable(),
					next == null ? null : next.getRHSAlias(),
					join.getRHSAlias(),
					entitySuffix,
			        collectionSuffix,
					join.getJoinType()==JoinType.LEFT_OUTER_JOIN
			);
			if (selectFragment.trim().length() > 0) {
				buf.append(", ").append(selectFragment);
			}
			if ( joinable.consumesEntityAlias() ) entityAliasCount++;
			if ( joinable.consumesCollectionAlias() && join.getJoinType()==JoinType.LEFT_OUTER_JOIN ) collectionAliasCount++;
		}
		return buf.toString();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:JoinWalker.java

示例7: applyRootReturnWhereJoinRestrictions

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
protected void applyRootReturnWhereJoinRestrictions(SelectStatementBuilder selectStatementBuilder) {
	final Joinable joinable = (OuterJoinLoadable) getRootEntityReturn().getEntityPersister();
	selectStatementBuilder.appendRestrictions(
			joinable.whereJoinFragment(
					entityReferenceAliases.getTableAlias(),
					true,
					true
			)
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:EntityLoadQueryDetails.java

示例8: addJoins

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
private void addJoins(
		Join join,
		JoinFragment joinFragment,
		Joinable joinable) {

	final String rhsTableAlias = aliasResolutionContext.resolveSqlTableAliasFromQuerySpaceUid(
			join.getRightHandSide().getUid()
	);
	if ( StringHelper.isEmpty( rhsTableAlias ) ) {
		throw new IllegalStateException( "Join's RHS table alias cannot be empty" );
	}

	final String lhsTableAlias = aliasResolutionContext.resolveSqlTableAliasFromQuerySpaceUid(
			join.getLeftHandSide().getUid()
	);
	if ( lhsTableAlias == null ) {
		throw new IllegalStateException( "QuerySpace with that UID was not yet registered in the AliasResolutionContext" );
	}

	// add join fragments from the collection table -> element entity table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	final String additionalJoinConditions = resolveAdditionalJoinCondition(
			rhsTableAlias,
			join.getAnyAdditionalJoinConditions( rhsTableAlias ),
			joinable,
			getJoinedAssociationTypeOrNull( join )
	);

	joinFragment.addJoin(
			joinable.getTableName(),
			rhsTableAlias,
			join.resolveAliasedLeftHandSideJoinConditionColumns( lhsTableAlias ),
			join.resolveNonAliasedRightHandSideJoinConditionColumns(),
			join.isRightHandSideRequired() ? JoinType.INNER_JOIN : JoinType.LEFT_OUTER_JOIN,
			additionalJoinConditions
	);
	joinFragment.addJoins(
			joinable.fromJoinFragment( rhsTableAlias, false, true ),
			joinable.whereJoinFragment( rhsTableAlias, false, true )
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:LoadQueryJoinAndFetchProcessor.java

示例9: renderManyToManyJoin

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
private void renderManyToManyJoin(
		Join join,
		JoinFragment joinFragment) {

	// for many-to-many we have 3 table aliases.  By way of example, consider a normal m-n: User<->Role
	// where User is the FetchOwner and Role (User.roles) is the Fetch.  We'd have:
	//		1) the owner's table : user - in terms of rendering the joins (not the fetch select fragments), the
	// 			lhs table alias is only needed to qualify the lhs join columns, but we already have the qualified
	// 			columns here (aliasedLhsColumnNames)
	//final String ownerTableAlias = ...;
	//		2) the m-n table : user_role
	//		3) the element table : role
	final EntityPersister entityPersister = ( (EntityQuerySpace) join.getRightHandSide() ).getEntityPersister();
	final String entityTableAlias = aliasResolutionContext.resolveSqlTableAliasFromQuerySpaceUid(
		join.getRightHandSide().getUid()
	);

	if ( StringHelper.isEmpty( entityTableAlias ) ) {
		throw new IllegalStateException( "Collection element (many-to-many) table alias cannot be empty" );
	}
	if ( JoinDefinedByMetadata.class.isInstance( join ) &&
			CollectionPropertyNames.COLLECTION_ELEMENTS.equals( ( (JoinDefinedByMetadata) join ).getJoinedPropertyName() ) ) {
		final CollectionQuerySpace leftHandSide = (CollectionQuerySpace) join.getLeftHandSide();
		final CollectionPersister persister = leftHandSide.getCollectionPersister();
		final String manyToManyFilter = persister.getManyToManyFilterFragment(
				entityTableAlias,
				buildingParameters.getQueryInfluencers().getEnabledFilters()
		);
		joinFragment.addCondition( manyToManyFilter );
	}

	addJoins(
			join,
			joinFragment,
			(Joinable) entityPersister
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:LoadQueryJoinAndFetchProcessor.java

示例10: startingEntity

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
@Override
public void startingEntity(EntityDefinition entityDefinition) {
	// see if the EntityDefinition is a root...
	final boolean isRoot = fetchSourceStack.isEmpty();
	if ( ! isRoot ) {
		// if not, this call should represent a fetch which should have been handled in #startingAttribute
		return;
	}

	// if we get here, it is a root

	log.tracef(
			"%s Starting root entity : %s",
			StringHelper.repeat( ">>", fetchSourceStack.size() ),
			entityDefinition.getEntityPersister().getEntityName()
	);

	if ( !supportsRootEntityReturns() ) {
		throw new HibernateException( "This strategy does not support root entity returns" );
	}

	final EntityReturnImpl entityReturn = new EntityReturnImpl( entityDefinition, querySpaces );
	addRootReturn( entityReturn );
	pushToStack( entityReturn );

	// also add an AssociationKey for the root so we can later on recognize circular references back to the root.
	final Joinable entityPersister = (Joinable) entityDefinition.getEntityPersister();
	associationKeyRegistered(
			new AssociationKey( entityPersister.getTableName(), entityPersister.getKeyColumnNames() )
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:AbstractLoadPlanBuildingAssociationVisitationStrategy.java

示例11: startingCollection

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
@Override
public void startingCollection(CollectionDefinition collectionDefinition) {
	// see if the EntityDefinition is a root...
	final boolean isRoot = fetchSourceStack.isEmpty();
	if ( ! isRoot ) {
		// if not, this call should represent a fetch which should have been handled in #startingAttribute
		return;
	}

	log.tracef(
			"%s Starting root collection : %s",
			StringHelper.repeat( ">>", fetchSourceStack.size() ),
			collectionDefinition.getCollectionPersister().getRole()
	);

	// if we get here, it is a root
	if ( ! supportsRootCollectionReturns() ) {
		throw new HibernateException( "This strategy does not support root collection returns" );
	}

	final CollectionReturn collectionReturn = new CollectionReturnImpl( collectionDefinition, querySpaces );
	pushToCollectionStack( collectionReturn );
	addRootReturn( collectionReturn );

	associationKeyRegistered(
			new AssociationKey(
					( (Joinable) collectionDefinition.getCollectionPersister() ).getTableName(),
					( (Joinable) collectionDefinition.getCollectionPersister() ).getKeyColumnNames()
			)
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:AbstractLoadPlanBuildingAssociationVisitationStrategy.java

示例12: foundCircularAssociation

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
@Override
public void foundCircularAssociation(AssociationAttributeDefinition attributeDefinition) {
	final FetchStrategy fetchStrategy = determineFetchStrategy( attributeDefinition );
	if ( fetchStrategy.getStyle() != FetchStyle.JOIN ) {
		return; // nothing to do
	}

	final AssociationKey associationKey = attributeDefinition.getAssociationKey();

	// go ahead and build the bidirectional fetch
	if ( attributeDefinition.getAssociationNature() == AssociationAttributeDefinition.AssociationNature.ENTITY ) {
		final Joinable currentEntityPersister = (Joinable) currentSource().resolveEntityReference().getEntityPersister();
		final AssociationKey currentEntityReferenceAssociationKey =
				new AssociationKey( currentEntityPersister.getTableName(), currentEntityPersister.getKeyColumnNames() );
		// if associationKey is equal to currentEntityReferenceAssociationKey
		// that means that the current EntityPersister has a single primary key attribute
		// (i.e., derived attribute) which is mapped by attributeDefinition.
		// This is not a bidirectional association.
		// TODO: AFAICT, to avoid an overflow, the associated entity must already be loaded into the session, or
		// it must be loaded when the ID for the dependent entity is resolved. Is there some other way to
		// deal with this???
		final FetchSource registeredFetchSource = registeredFetchSource( associationKey );
		if ( registeredFetchSource != null && ! associationKey.equals( currentEntityReferenceAssociationKey ) ) {
			currentSource().buildBidirectionalEntityReference(
					attributeDefinition,
					fetchStrategy,
					registeredFetchSource( associationKey ).resolveEntityReference()
			);
		}
	}
	else {
		// Do nothing for collection
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:AbstractLoadPlanBuildingAssociationVisitationStrategy.java

示例13: manyToManySelectFragment

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
private String manyToManySelectFragment(
        Joinable rhs,
        String rhsAlias,
        String lhsAlias,
        String collectionSuffix) {
	SelectFragment frag = generateSelectFragment( lhsAlias, collectionSuffix );

	String[] elementColumnNames = rhs.getKeyColumnNames();
	frag.addColumns( rhsAlias, elementColumnNames, elementColumnAliases );
	appendIndexColumns( frag, lhsAlias );
	appendIdentifierColumns( frag, lhsAlias );

	return frag.toFragmentString()
			.substring( 2 ); //strip leading ','
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:BasicCollectionPersister.java

示例14: fromJoinFragment

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
@Override
public String fromJoinFragment(
		String alias,
		boolean innerJoin,
		boolean includeSubclasses,
		Set<String> treatAsDeclarations) {
	return ( (Joinable) getElementPersister() ).fromJoinFragment( alias, innerJoin, includeSubclasses, treatAsDeclarations );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:OneToManyPersister.java

示例15: whereJoinFragment

import org.hibernate.persister.entity.Joinable; //导入依赖的package包/类
@Override
public String whereJoinFragment(
		String alias,
		boolean innerJoin,
		boolean includeSubclasses,
		Set<String> treatAsDeclarations) {
	return ( (Joinable) getElementPersister() ).whereJoinFragment( alias, innerJoin, includeSubclasses, treatAsDeclarations );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:OneToManyPersister.java


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