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


Java CollectionPersister.getIndexType方法代码示例

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


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

示例1: initializeFromCache

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) {
	final Type elementType = persister.getElementType();
	final Type indexType = persister.getIndexType();
	final String indexNodeName = getIndexAttributeName( persister );

	final Serializable[] cached = (Serializable[]) disassembled;
	int i = 0;
	while ( i < cached.length ) {
		final Object index = indexType.assemble( cached[i++], getSession(), owner );
		final Object object = elementType.assemble( cached[i++], getSession(), owner );

		final Element subElement = element.addElement( persister.getElementNodeName() );
		elementType.setToXMLNode( subElement, object, persister.getFactory() );

		final String indexString = ( (XmlRepresentableType) indexType ).toXMLString( index, persister.getFactory() );
		setIndex( subElement, indexNodeName, indexString );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:PersistentMapElementHolder.java

示例2: disassemble

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Serializable disassemble(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final Type indexType = persister.getIndexType();
	final String indexNodeName = getIndexAttributeName( persister );

	final List elements =  element.elements( persister.getElementNodeName() );
	final int length = elements.size();
	final Serializable[] result = new Serializable[length*2];
	int i = 0;
	while ( i < length*2 ) {
		final Element elem = (Element) elements.get( i/2 );
		final Object object = elementType.fromXMLNode( elem, persister.getFactory() );
		final String indexString = getIndex( elem, indexNodeName, i );
		final Object index = ( (XmlRepresentableType) indexType ).fromXMLString( indexString, persister.getFactory() );
		result[i++] = indexType.disassemble( index, getSession(), null );
		result[i++] = elementType.disassemble( object, getSession(), null );
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PersistentMapElementHolder.java

示例3: readFrom

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"deprecation", "unchecked"})
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
		throws HibernateException, SQLException {
	final Object object = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
	final Type elementType = persister.getElementType();
	final SessionFactoryImplementor factory = persister.getFactory();
	final String indexNode = getIndexAttributeName( persister );

	final Element elem = element.addElement( persister.getElementNodeName() );
	elementType.setToXMLNode( elem, object, factory ); 

	final Type indexType = persister.getIndexType();
	final Object indexValue = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
	final String index = ( (XmlRepresentableType) indexType ).toXMLString( indexValue, factory );
	setIndex( elem, indexNode, index );
	return object;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:PersistentIndexedElementHolder.java

示例4: getDeletes

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"deprecation", "unchecked"})
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException {
	final Type indexType = persister.getIndexType();
	final HashMap snapshot = (HashMap) getSnapshot();
	final HashMap deletes = (HashMap) snapshot.clone();
	deletes.keySet().removeAll( ( (HashMap) getSnapshot( persister ) ).keySet() );
	final ArrayList deleteList = new ArrayList( deletes.size() );
	for ( Object o : deletes.entrySet() ) {
		final Map.Entry me = (Map.Entry) o;
		final Object object = indexIsFormula
				? me.getValue()
				: ( (XmlRepresentableType) indexType ).fromXMLString( (String) me.getKey(), persister.getFactory() );
		if ( object != null ) {
			deleteList.add( object );
		}
	}
	return deleteList.iterator();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:PersistentIndexedElementHolder.java

示例5: getIndex

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Object getIndex(Object entry, int i, CollectionPersister persister) {
	final String index = ( (IndexedValue) entry ).index;
	final Type indexType = persister.getIndexType();
	return ( (XmlRepresentableType) indexType ).fromXMLString( index, persister.getFactory() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:PersistentIndexedElementHolder.java

示例6: buildIndexGraph

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
private CollectionFetchableIndex buildIndexGraph(
		ExpandingCollectionQuerySpace collectionQuerySpace,
		boolean shouldIncludeJoins) {
	final CollectionPersister persister = collectionQuerySpace.getCollectionPersister();
	if ( persister.hasIndex() ) {
		final Type type = persister.getIndexType();
		if ( type.isAssociationType() ) {
			if ( type.isEntityType() ) {
				final EntityPersister indexPersister = persister.getFactory().getEntityPersister(
						( (EntityType) type ).getAssociatedEntityName()
				);

				final ExpandingEntityQuerySpace entityQuerySpace = QuerySpaceHelper.INSTANCE.makeEntityQuerySpace(
						collectionQuerySpace,
						indexPersister,
						CollectionPropertyNames.COLLECTION_INDICES,
						(EntityType) persister.getIndexType(),
						collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(),
						collectionQuerySpace.canJoinsBeRequired(),
						shouldIncludeJoins
				);
				return new CollectionFetchableIndexEntityGraph( this, entityQuerySpace );
			}
			else if ( type.isAnyType() ) {
				return new CollectionFetchableIndexAnyGraph( this );
			}
		}
		else if ( type.isComponentType() ) {
			final ExpandingCompositeQuerySpace compositeQuerySpace = QuerySpaceHelper.INSTANCE.makeCompositeQuerySpace(
					collectionQuerySpace,
					new CompositePropertyMapping(
							(CompositeType) persister.getIndexType(),
							(PropertyMapping) persister,
							""
					),
					CollectionPropertyNames.COLLECTION_INDICES,
					(CompositeType) persister.getIndexType(),
					collectionQuerySpace.getExpandingQuerySpaces().generateImplicitUid(),
					collectionQuerySpace.canJoinsBeRequired(),
					shouldIncludeJoins
			);
			return new CollectionFetchableIndexCompositeGraph( this, compositeQuerySpace );
		}
	}

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


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