org.hibernate.type.AssociationType#getAssociatedJoinable ( )源码实例Demo

下面列出了org.hibernate.type.AssociationType#getAssociatedJoinable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: OuterJoinableAssociation.java
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
}
 
源代码2 项目: cacheonix-core   文件: OuterJoinableAssociation.java
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
}
 
源代码3 项目: cacheonix-core   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码4 项目: lams   文件: EntityBasedAssociationAttribute.java
@Override
public AssociationKey getAssociationKey() {
	final AssociationType type = getType();

	if ( type.isAnyType() ) {
		return new AssociationKey(
				JoinHelper.getLHSTableName( type, attributeNumber(), (OuterJoinLoadable) getSource() ),
				JoinHelper.getLHSColumnNames(
						type,
						attributeNumber(),
						0,
						(OuterJoinLoadable) getSource(),
						sessionFactory()
				)
		);
	}

	final Joinable joinable = type.getAssociatedJoinable( sessionFactory() );

	if ( type.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) {
		final String lhsTableName;
		final String[] lhsColumnNames;

		if ( joinable.isCollection() ) {
			final QueryableCollection collectionPersister = (QueryableCollection) joinable;
			lhsTableName = collectionPersister.getTableName();
			lhsColumnNames = collectionPersister.getElementColumnNames();
		}
		else {
			final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source();
			lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister );
			lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() );
		}
		return new AssociationKey( lhsTableName, lhsColumnNames );
	}
	else {
		return new AssociationKey( joinable.getTableName(), getRHSColumnNames( type, sessionFactory() ) );
	}
}
 
源代码5 项目: lams   文件: JoinHelper.java
/**
 * Get the columns of the associated table which are to be used in the join
 *
 * @param type The type
 * @param factory The SessionFactory
 *
 * @return The columns for the right-hand-side of the join
 */
public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) {
	final String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName();
	final Joinable joinable = type.getAssociatedJoinable( factory );
	if ( uniqueKeyPropertyName == null ) {
		return joinable.getKeyColumnNames();
	}
	else {
		return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames( uniqueKeyPropertyName );
	}
}
 
源代码6 项目: lams   文件: JoinSequence.java
Join(
		SessionFactoryImplementor factory,
		AssociationType associationType,
		String alias,
		JoinType joinType,
		String[][] lhsColumns) throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码7 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码8 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码9 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码10 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码11 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码12 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码13 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码14 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码15 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码16 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码17 项目: Knowage-Server   文件: JoinSequence.java
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns)
		throws MappingException {
	this.associationType = associationType;
	this.joinable = associationType.getAssociatedJoinable( factory );
	this.alias = alias;
	this.joinType = joinType;
	this.lhsColumns = lhsColumns;
}
 
源代码18 项目: cacheonix-core   文件: JoinHelper.java
/**
 * Get the columns of the associated table which are to 
 * be used in the join
 */
public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) {
	String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName();
	Joinable joinable = type.getAssociatedJoinable(factory);
	if (uniqueKeyPropertyName==null) {
		return joinable.getKeyColumnNames();
	}
	else {
		return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName);
	}
}
 
源代码19 项目: lams   文件: JoinWalker.java
/**
	 * Add on association (one-to-one, many-to-one, or a collection) to a list
	 * of associations to be fetched by outerjoin
	 */
	private void addAssociationToJoinTree(
			final AssociationType type,
			final String[] aliasedLhsColumns,
			final String alias,
			final PropertyPath path,
			final int currentDepth,
			final JoinType joinType) throws MappingException {

		Joinable joinable = type.getAssociatedJoinable( getFactory() );

		// important to generate alias based on size of association collection
		// *before* adding this join to that collection
		String subalias = generateTableAlias( associations.size() + 1, path, joinable );

		// NOTE : it should be fine to continue to pass only filters below
		// (instead of LoadQueryInfluencers) since "from that point on" we
		// only need to worry about restrictions (and not say adding more
		// joins)
		OuterJoinableAssociation assoc = new OuterJoinableAssociation(
				path,
				type,
				alias,
				aliasedLhsColumns,
				subalias,
				joinType,
				joinable.consumesEntityAlias() ? getWithClause( path ) : "",
				hasRestriction( path ),
				getFactory(),
				loadQueryInfluencers.getEnabledFilters()
		);
		assoc.validateJoin( path.getFullPath() );
		associations.add( assoc );

		int nextDepth = currentDepth + 1;
//		path = "";
		if ( !joinable.isCollection() ) {
			if ( joinable instanceof OuterJoinLoadable ) {
				walkEntityTree(
						(OuterJoinLoadable) joinable,
						subalias,
						path,
						nextDepth
				);
			}
		}
		else {
			if ( joinable instanceof QueryableCollection ) {
				walkCollectionTree(
						(QueryableCollection) joinable,
						subalias,
						path,
						nextDepth
				);
			}
		}

	}
 
源代码20 项目: lams   文件: AttributeNodeImpl.java
@SuppressWarnings("unchecked")
private <X> SubgraphImpl<X> internalMakeKeySubgraph(Class<X> type) {
	if ( ! attribute.isCollection() ) {
		throw new IllegalArgumentException(
				String.format( "Non-collection attribute [%s] cannot be target of key subgraph", getAttributeName() )
		);
	}

	final PluralAttributeImpl pluralAttribute = (PluralAttributeImpl) attribute;
	if ( pluralAttribute.getCollectionType() != PluralAttribute.CollectionType.MAP ) {
		throw new IllegalArgumentException(
				String.format( "Non-Map attribute [%s] cannot be target of key subgraph", getAttributeName() )
		);
	}

	final AssociationType attributeType = (AssociationType) Helper.resolveType( sessionFactory(), attribute );
	final QueryableCollection collectionPersister = (QueryableCollection) attributeType.getAssociatedJoinable( sessionFactory() );
	final Type indexType = collectionPersister.getIndexType();

	if ( ! indexType.isAssociationType() ) {
		throw new IllegalArgumentException(
				String.format( "Map index [%s] is not an entity; cannot be target of key subgraph", getAttributeName() )
		);
	}

	if ( keySubgraphMap == null ) {
		keySubgraphMap = new HashMap<>();
	}

	final AssociationType indexAssociationType = (AssociationType) indexType;
	final EntityPersister indexEntityPersister = (EntityPersister) indexAssociationType.getAssociatedJoinable( sessionFactory() );

	if ( type == null ) {
		type = indexEntityPersister.getMappedClass();
	}
	else {
		if ( !isTreatableAs( indexEntityPersister, type ) ) {
			throw new IllegalArgumentException(
					String.format(
							"Map key [%s] cannot be treated as requested type [%s] : %s",
							getAttributeName(),
							type.getName(),
							indexEntityPersister.getMappedClass().getName()
					)
			);
		}
	}

	final SubgraphImpl<X> subgraph = new SubgraphImpl<>( this.sessionFactory, attribute.getDeclaringType(), type );
	keySubgraphMap.put( type, subgraph );
	return subgraph;
}