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


Java CollectionType.getAssociatedEntityName方法代码示例

本文整理汇总了Java中org.hibernate.type.CollectionType.getAssociatedEntityName方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionType.getAssociatedEntityName方法的具体用法?Java CollectionType.getAssociatedEntityName怎么用?Java CollectionType.getAssociatedEntityName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.type.CollectionType的用法示例。


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

示例1: getChildCollection

import org.hibernate.type.CollectionType; //导入方法依赖的package包/类
@Override
public EntityCollection getChildCollection(String name) throws LayerException {
	Type type = metadata.getPropertyType(name);
	if (type instanceof CollectionType) {
		CollectionType ct = (CollectionType) type;
		Collection coll = (Collection) metadata.getPropertyValue(object, name, EntityMode.POJO);
		if (coll == null) {
			// normally should not happen, hibernate instantiates it automatically
			coll = (Collection) ct.instantiate(0);
			metadata.setPropertyValue(object, name, coll, EntityMode.POJO);
		}
		String entityName = ct.getAssociatedEntityName((SessionFactoryImplementor) sessionFactory);
		ClassMetadata childMetadata = sessionFactory.getClassMetadata(entityName);
		return new HibernateEntityCollection(metadata, childMetadata, object, coll);
	} else {
		throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:19,代码来源:HibernateEntityMapper.java

示例2: cascadeCollectionElements

import org.hibernate.type.CollectionType; //导入方法依赖的package包/类
/**
 * Cascade to the collection elements
 */
private void cascadeCollectionElements(
		final Object child,
		final CollectionType collectionType,
		final CascadeStyle style,
		final Type elemType,
		final Object anything,
		final boolean isCascadeDeleteEnabled) throws HibernateException {
	// we can't cascade to non-embedded elements
	boolean embeddedElements = eventSource.getEntityMode()!=EntityMode.DOM4J ||
			( (EntityType) collectionType.getElementType( eventSource.getFactory() ) ).isEmbeddedInXML();

	boolean reallyDoCascade = style.reallyDoCascade(action) &&
		embeddedElements && child!=CollectionType.UNFETCHED_COLLECTION;

	if ( reallyDoCascade ) {
		if ( log.isTraceEnabled() ) {
			log.trace( "cascade " + action + " for collection: " + collectionType.getRole() );
		}

		Iterator iter = action.getCascadableChildrenIterator(eventSource, collectionType, child);
		while ( iter.hasNext() ) {
			cascadeProperty(
					iter.next(),
					elemType,
					style,
					anything,
					isCascadeDeleteEnabled
				);
		}

		if ( log.isTraceEnabled() ) {
			log.trace( "done cascade " + action + " for collection: " + collectionType.getRole() );
		}
	}

	final boolean deleteOrphans = style.hasOrphanDelete() &&
			action.deleteOrphans() &&
			elemType.isEntityType() &&
			child instanceof PersistentCollection; //a newly instantiated collection can't have orphans

	if ( deleteOrphans ) { // handle orphaned entities!!
		if ( log.isTraceEnabled() ) {
			log.trace( "deleting orphans for collection: " + collectionType.getRole() );
		}

		// we can do the cast since orphan-delete does not apply to:
		// 1. newly instantiated collections
		// 2. arrays (we can't track orphans for detached arrays)
		final String entityName = collectionType.getAssociatedEntityName( eventSource.getFactory() );
		deleteOrphans( entityName, (PersistentCollection) child );

		if ( log.isTraceEnabled() ) {
			log.trace( "done deleting orphans for collection: " + collectionType.getRole() );
		}
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:60,代码来源:Cascade.java

示例3: getAssociatedEntityName

import org.hibernate.type.CollectionType; //导入方法依赖的package包/类
/**
 * Given a collection type, determine the entity name of the elements
 * contained within instance of that collection.
 *
 * @param collectionType The collection type to check.
 *
 * @return The entity name of the elements of this collection.
 */
public String getAssociatedEntityName(CollectionType collectionType) {
	return collectionType.getAssociatedEntityName( sfi );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:SessionFactoryHelper.java

示例4: getAssociatedEntityName

import org.hibernate.type.CollectionType; //导入方法依赖的package包/类
/**
 * Given a collection type, determine the entity name of the elements
 * contained within instance of that collection.
 *
 * @param collectionType The collection type to check.
 * @return The entity name of the elements of this collection.
 */
public String getAssociatedEntityName(CollectionType collectionType) {
	return collectionType.getAssociatedEntityName( sfi );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:SessionFactoryHelper.java


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