當前位置: 首頁>>代碼示例>>Java>>正文


Java PersistentClass.getJoinIterator方法代碼示例

本文整理匯總了Java中org.hibernate.mapping.PersistentClass.getJoinIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java PersistentClass.getJoinIterator方法的具體用法?Java PersistentClass.getJoinIterator怎麽用?Java PersistentClass.getJoinIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.mapping.PersistentClass的用法示例。


在下文中一共展示了PersistentClass.getJoinIterator方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: associateSubclassNamesToSubclassTableIndexes

import org.hibernate.mapping.PersistentClass; //導入方法依賴的package包/類
private void associateSubclassNamesToSubclassTableIndexes(
		PersistentClass persistentClass,
		Set<String> classNames,
		String[][] mapping,
		SessionFactoryImplementor factory) {

	final String tableName = persistentClass.getTable().getQualifiedName(
			factory.getDialect(),
			factory.getSettings().getDefaultCatalogName(),
			factory.getSettings().getDefaultSchemaName()
	);

	associateSubclassNamesToSubclassTableIndex( tableName, classNames, mapping );

	Iterator itr = persistentClass.getJoinIterator();
	while ( itr.hasNext() ) {
		final Join join = (Join) itr.next();
		final String secondaryTableName = join.getTable().getQualifiedName(
				factory.getDialect(),
				factory.getSettings().getDefaultCatalogName(),
				factory.getSettings().getDefaultSchemaName()
		);
		associateSubclassNamesToSubclassTableIndex( secondaryTableName, classNames, mapping );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:26,代碼來源:JoinedSubclassEntityPersister.java

示例2: bindManytoManyInverseFk

import org.hibernate.mapping.PersistentClass; //導入方法依賴的package包/類
/**
 * bind the inverse FK of a ManyToMany
 * If we are in a mappedBy case, read the columns from the associated
 * collection element
 * Otherwise delegates to the usual algorithm
 */
public static void bindManytoManyInverseFk(
		PersistentClass referencedEntity,
		Ejb3JoinColumn[] columns,
		SimpleValue value,
		boolean unique,
		Mappings mappings) {
	final String mappedBy = columns[0].getMappedBy();
	if ( StringHelper.isNotEmpty( mappedBy ) ) {
		final Property property = referencedEntity.getRecursiveProperty( mappedBy );
		Iterator mappedByColumns;
		if ( property.getValue() instanceof Collection ) {
			mappedByColumns = ( (Collection) property.getValue() ).getKey().getColumnIterator();
		}
		else {
			//find the appropriate reference key, can be in a join
			Iterator joinsIt = referencedEntity.getJoinIterator();
			KeyValue key = null;
			while ( joinsIt.hasNext() ) {
				Join join = (Join) joinsIt.next();
				if ( join.containsProperty( property ) ) {
					key = join.getKey();
					break;
				}
			}
			if ( key == null ) key = property.getPersistentClass().getIdentifier();
			mappedByColumns = key.getColumnIterator();
		}
		while ( mappedByColumns.hasNext() ) {
			Column column = (Column) mappedByColumns.next();
			columns[0].linkValueUsingAColumnCopy( column, value );
		}
		String referencedPropertyName =
				mappings.getPropertyReferencedAssociation(
						"inverse__" + referencedEntity.getEntityName(), mappedBy
				);
		if ( referencedPropertyName != null ) {
			//TODO always a many to one?
			( (ManyToOne) value ).setReferencedPropertyName( referencedPropertyName );
			mappings.addUniquePropertyReference( referencedEntity.getEntityName(), referencedPropertyName );
		}
		( (ManyToOne) value ).setReferenceToPrimaryKey( referencedPropertyName == null );
		value.createForeignKey();
	}
	else {
		BinderHelper.createSyntheticPropertyReference( columns, referencedEntity, null, value, true, mappings );
		TableBinder.bindFk( referencedEntity, null, columns, value, unique, mappings );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:55,代碼來源:CollectionBinder.java


注:本文中的org.hibernate.mapping.PersistentClass.getJoinIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。