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


Java Type.disassemble方法代码示例

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


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

示例1: disassemble

import org.hibernate.type.Type; //导入方法依赖的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

示例2: disassemble

import org.hibernate.type.Type; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Serializable disassemble(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final String indexNodeName = getIndexAttributeName( persister );
	final List elements =  element.elements( persister.getElementNodeName() );
	final int length = elements.size();
	final Serializable[] result = new Serializable[length];
	for ( int i=0; i<length; i++ ) {
		final Element elem = (Element) elements.get( i );
		final Object object = elementType.fromXMLNode( elem, persister.getFactory() );
		final Integer index = IntegerType.INSTANCE.fromString( getIndex( elem, indexNodeName, i ) );
		result[index] = elementType.disassemble( object, getSession(), null );
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PersistentListElementHolder.java

示例3: NaturalIdCacheKey

import org.hibernate.type.Type; //导入方法依赖的package包/类
/**
 * Construct a new key for a caching natural identifier resolutions into the second level cache.
 * Note that an entity name should always be the root entity name, not a subclass entity name.
 *
 * @param naturalIdValues The naturalIdValues associated with the cached data
 * @param persister The persister for the entity
 * @param session The originating session
 */
public NaturalIdCacheKey(
		final Object[] naturalIdValues,
		final EntityPersister persister,
		final SessionImplementor session) {

	this.entityName = persister.getRootEntityName();
	this.tenantId = session.getTenantIdentifier();

	this.naturalIdValues = new Serializable[naturalIdValues.length];

	final SessionFactoryImplementor factory = session.getFactory();
	final int[] naturalIdPropertyIndexes = persister.getNaturalIdentifierProperties();
	final Type[] propertyTypes = persister.getPropertyTypes();

	final int prime = 31;
	int result = 1;
	result = prime * result + ( ( this.entityName == null ) ? 0 : this.entityName.hashCode() );
	result = prime * result + ( ( this.tenantId == null ) ? 0 : this.tenantId.hashCode() );
	for ( int i = 0; i < naturalIdValues.length; i++ ) {
		final int naturalIdPropertyIndex = naturalIdPropertyIndexes[i];
		final Type type = propertyTypes[naturalIdPropertyIndex];
		final Object value = naturalIdValues[i];

		result = prime * result + (value != null ? type.getHashCode( value, factory ) : 0);

		// The natural id may not be fully resolved in some situations.  See HHH-7513 for one of them
		// (re-attaching a mutable natural id uses a database snapshot and hydration does not resolve associations).
		// TODO: The snapshot should probably be revisited at some point.  Consider semi-resolving, hydrating, etc.
		if (type instanceof EntityType && type.getSemiResolvedType( factory ).getReturnedClass().isInstance( value )) {
			this.naturalIdValues[i] = (Serializable) value;
		}
		else {
			this.naturalIdValues[i] = type.disassemble( value, session, null );
		}
	}

	this.hashCode = result;
	initTransients();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:48,代码来源:NaturalIdCacheKey.java

示例4: disassemble

import org.hibernate.type.Type; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Serializable disassemble(CollectionPersister persister) throws HibernateException {
	final Type collectionElementType = persister.getElementType();
	final List elements =  element.elements( persister.getElementNodeName() );
	final int length = elements.size();
	final Serializable[] result = new Serializable[length];
	for ( int i=0; i<length; i++ ) {
		final Element elem = (Element) elements.get( i );
		final Object object = collectionElementType.fromXMLNode( elem, persister.getFactory() );
		result[i] = collectionElementType.disassemble( object, getSession(), null );
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:PersistentElementHolder.java


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