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


Java CollectionType类代码示例

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


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

示例1: addAssociationsToTheSetForOneProperty

import org.hibernate.type.CollectionType; //导入依赖的package包/类
private void addAssociationsToTheSetForOneProperty(String name, Type type, String prefix, SessionFactoryImplementor factory) {

		if ( type.isCollectionType() ) {
			CollectionType collType = (CollectionType) type;
			Type assocType = collType.getElementType( factory );
			addAssociationsToTheSetForOneProperty(name, assocType, prefix, factory);
		}
		//ToOne association
		else if ( type.isEntityType() || type.isAnyType() ) {
			associations.add( prefix + name );
		} else if ( type.isComponentType() ) {
			CompositeType componentType = (CompositeType) type;
			addAssociationsToTheSetForAllProperties(
					componentType.getPropertyNames(),
					componentType.getSubtypes(),
					(prefix.equals( "" ) ? name : prefix + name) + ".",
					factory);
		}
	}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:HibernateTraversableResolver.java

示例2: getDefaultCollectionType

import org.hibernate.type.CollectionType; //导入依赖的package包/类
public CollectionType getDefaultCollectionType() {
	if ( isSorted() ) {
		return getMappings().getTypeResolver()
				.getTypeFactory()
				.sortedMap( getRole(), getReferencedPropertyName(), getComparator() );
	}
	else if ( hasOrder() ) {
		return getMappings().getTypeResolver()
				.getTypeFactory()
				.orderedMap( getRole(), getReferencedPropertyName() );
	}
	else {
		return getMappings().getTypeResolver()
				.getTypeFactory()
				.map( getRole(), getReferencedPropertyName() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:Map.java

示例3: getDefaultCollectionType

import org.hibernate.type.CollectionType; //导入依赖的package包/类
public CollectionType getDefaultCollectionType() {
	if ( isSorted() ) {
		return getMappings().getTypeResolver()
				.getTypeFactory()
				.sortedSet( getRole(), getReferencedPropertyName(), getComparator() );
	}
	else if ( hasOrder() ) {
		return getMappings().getTypeResolver()
				.getTypeFactory()
				.orderedSet( getRole(), getReferencedPropertyName() );
	}
	else {
		return getMappings().getTypeResolver()
				.getTypeFactory()
				.set( getRole(), getReferencedPropertyName() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:Set.java

示例4: getQueryableCollection

import org.hibernate.type.CollectionType; //导入依赖的package包/类
protected QueryableCollection getQueryableCollection(
		String entityName,
		String propertyName,
		SessionFactoryImplementor factory) throws HibernateException {
	final PropertyMapping ownerMapping = (PropertyMapping) factory.getEntityPersister( entityName );
	final Type type = ownerMapping.toType( propertyName );
	if ( !type.isCollectionType() ) {
		throw new MappingException(
				"Property path [" + entityName + "." + propertyName + "] does not reference a collection"
		);
	}

	final String role = ( (CollectionType) type ).getRole();
	try {
		return (QueryableCollection) factory.getCollectionPersister( role );
	}
	catch ( ClassCastException cce ) {
		throw new QueryException( "collection role is not queryable: " + role );
	}
	catch ( Exception e ) {
		throw new QueryException( "collection role not found: " + role );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AbstractEmptinessExpression.java

示例5: createCollectionJoin

import org.hibernate.type.CollectionType; //导入依赖的package包/类
public JoinDefinedByMetadata createCollectionJoin(
		QuerySpace leftHandSide,
		String lhsPropertyName,
		CollectionQuerySpace rightHandSide,
		boolean rightHandSideRequired,
		CollectionType joinedPropertyType,
		SessionFactoryImplementor sessionFactory) {
	return new JoinImpl(
			leftHandSide,
			lhsPropertyName,
			rightHandSide,
			joinedPropertyType.getAssociatedJoinable( sessionFactory ).getKeyColumnNames(),
			joinedPropertyType,
			rightHandSideRequired
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:JoinHelper.java

示例6: checkSubElementsNullability

import org.hibernate.type.CollectionType; //导入依赖的package包/类
/**
 * check sub elements-nullability. Returns property path that break
 * nullability or null if none
 *
 * @param propertyType type to check
 * @param value value to check
 *
 * @return property path
 * @throws HibernateException error while getting subcomponent values
 */
private String checkSubElementsNullability(Type propertyType, Object value) throws HibernateException {
	if ( propertyType.isComponentType() ) {
		return checkComponentNullability( value, (CompositeType) propertyType );
	}

	if ( propertyType.isCollectionType() ) {
		// persistent collections may have components
		final CollectionType collectionType = (CollectionType) propertyType;
		final Type collectionElementType = collectionType.getElementType( session.getFactory() );

		if ( collectionElementType.isComponentType() ) {
			// check for all components values in the collection
			final CompositeType componentType = (CompositeType) collectionElementType;
			final Iterator itr = CascadingActions.getLoadedElementsIterator( session, collectionType, value );
			while ( itr.hasNext() ) {
				final Object compositeElement = itr.next();
				if ( compositeElement != null ) {
					return checkComponentNullability( compositeElement, componentType );
				}
			}
		}
	}

	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:Nullability.java

示例7: processCollection

import org.hibernate.type.CollectionType; //导入依赖的package包/类
@Override
Object processCollection(Object collection, CollectionType collectionType)
		throws HibernateException {

	if ( collection != null && ( collection instanceof PersistentCollection ) ) {

		final SessionImplementor session = getSession();
		PersistentCollection coll = (PersistentCollection) collection;
		if ( coll.setCurrentSession( session ) ) {
			reattachCollection( coll, collectionType );
		}
		return null;

	}
	else {
		return processArrayOrNewCollection( collection, collectionType );
	}

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:WrapVisitor.java

示例8: processValue

import org.hibernate.type.CollectionType; //导入依赖的package包/类
/**
 * Visit a property value. Dispatch to the
 * correct handler for the property type.
 * @param value
 * @param type
 * @throws HibernateException
 */
final Object processValue(Object value, Type type) throws HibernateException {

	if ( type.isCollectionType() ) {
		//even process null collections
		return processCollection( value, (CollectionType) type );
	}
	else if ( type.isEntityType() ) {
		return processEntity( value, (EntityType) type );
	}
	else if ( type.isComponentType() ) {
		return processComponent( value, (CompositeType) type );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AbstractVisitor.java

示例9: evictCollection

import org.hibernate.type.CollectionType; //导入依赖的package包/类
public void evictCollection(Object value, CollectionType type) {

		final Object pc;
		if ( type.hasHolder() ) {
			pc = getSession().getPersistenceContext().removeCollectionHolder(value);
		}
		else if ( value instanceof PersistentCollection ) {
			pc = value;
		}
		else {
			return; //EARLY EXIT!
		}

		PersistentCollection collection = (PersistentCollection) pc;
		if ( collection.unsetSession( getSession() ) ) evictCollection(collection);
	}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:EvictVisitor.java

示例10: end

import org.hibernate.type.CollectionType; //导入依赖的package包/类
public void end(QueryTranslatorImpl q) throws QueryException {
	ignoreInitialJoin = false;

	Type propertyType = getPropertyType();
	if ( propertyType != null && propertyType.isCollectionType() ) {
		collectionRole = ( ( CollectionType ) propertyType ).getRole();
		collectionName = q.createNameForCollection( collectionRole );
		prepareForIndex( q );
	}
	else {
		columns = currentColumns();
		setType();
	}

	//important!!
	continuation = false;

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:PathExpressionParser.java

示例11: getQueryableCollection

import org.hibernate.type.CollectionType; //导入依赖的package包/类
protected QueryableCollection getQueryableCollection(String entityName, String propertyName, SessionFactoryImplementor factory)
        throws HibernateException {
	PropertyMapping ownerMapping = ( PropertyMapping ) factory.getEntityPersister( entityName );
	Type type = ownerMapping.toType( propertyName );
	if ( !type.isCollectionType() ) {
		throw new MappingException(
		        "Property path [" + entityName + "." + propertyName + "] does not reference a collection"
		);
	}

	String role = ( ( CollectionType ) type ).getRole();
	try {
		return ( QueryableCollection ) factory.getCollectionPersister( role );
	}
	catch ( ClassCastException cce ) {
		throw new QueryException( "collection role is not queryable: " + role );
	}
	catch ( Exception e ) {
		throw new QueryException( "collection role not found: " + role );
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:AbstractEmptinessExpression.java

示例12: processCollection

import org.hibernate.type.CollectionType; //导入依赖的package包/类
Object processCollection(Object collection, CollectionType collectionType)
throws HibernateException {

	if ( collection!=null && (collection instanceof PersistentCollection) ) {

		final SessionImplementor session = getSession();
		PersistentCollection coll = (PersistentCollection) collection;
		if ( coll.setCurrentSession(session) ) {
			reattachCollection( coll, collectionType );
		}
		return null;

	}
	else {
		return processArrayOrNewCollection(collection, collectionType);
	}

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

示例13: processValue

import org.hibernate.type.CollectionType; //导入依赖的package包/类
/**
 * Visit a property value. Dispatch to the
 * correct handler for the property type.
 * @param value
 * @param type
 * @throws HibernateException
 */
final Object processValue(Object value, Type type) throws HibernateException {

	if ( type.isCollectionType() ) {
		//even process null collections
		return processCollection( value, (CollectionType) type );
	}
	else if ( type.isEntityType() ) {
		return processEntity( value, (EntityType) type );
	}
	else if ( type.isComponentType() ) {
		return processComponent( value, (AbstractComponentType) type );
	}
	else {
		return null;
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:24,代码来源:AbstractVisitor.java

示例14: evictCollection

import org.hibernate.type.CollectionType; //导入依赖的package包/类
public void evictCollection(Object value, CollectionType type) {

		final Object pc;
		if ( type.hasHolder( getSession().getEntityMode() ) ) {
			pc = getSession().getPersistenceContext().removeCollectionHolder(value);
		}
		else if ( value instanceof PersistentCollection ) {
			pc = value;
		}
		else {
			return; //EARLY EXIT!
		}

		PersistentCollection collection = (PersistentCollection) pc;
		if ( collection.unsetSession( getSession() ) ) evictCollection(collection);
	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:17,代码来源:EvictVisitor.java

示例15: copyProperties

import org.hibernate.type.CollectionType; //导入依赖的package包/类
/**
 * Copies the persistent properties from the source to the destination entity
 */
public void copyProperties(final Entity source, final Entity dest) {
    if (source == null || dest == null) {
        return;
    }
    final ClassMetadata metaData = getClassMetaData(source);
    final Object[] values = metaData.getPropertyValues(source, EntityMode.POJO);
    // Skip the collections
    final Type[] types = metaData.getPropertyTypes();
    for (int i = 0; i < types.length; i++) {
        final Type type = types[i];
        if (type instanceof CollectionType) {
            values[i] = null;
        }
    }
    metaData.setPropertyValues(dest, values, EntityMode.POJO);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:20,代码来源:HibernateQueryHandler.java


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