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


Java CollectionPersister.getElementType方法代码示例

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


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

示例1: createCollectionElementAliases

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
private EntityReferenceAliases createCollectionElementAliases(
		CollectionPersister collectionPersister,
		String tableAlias,
		String elementQuerySpaceUid) {

	if ( !collectionPersister.getElementType().isEntityType() ) {
		return null;
	}
	else {
		final EntityType entityElementType = (EntityType) collectionPersister.getElementType();
		return generateEntityReferenceAliases(
				elementQuerySpaceUid,
				tableAlias,
				(EntityPersister) entityElementType.getAssociatedJoinable( sessionFactory() )
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AliasResolutionContextImpl.java

示例2: getSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"unchecked", "deprecation"})
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final String indexNode = getIndexAttributeName( persister );
	final List elements = element.elements( persister.getElementNodeName() );
	final HashMap snapshot = new HashMap( elements.size() );
	for ( int i=0; i<elements.size(); i++ ) {
		final Element elem = (Element) elements.get( i );
		final Object value = elementType.fromXMLNode( elem, persister.getFactory() );
		final Object copy = elementType.deepCopy( value, persister.getFactory() );
		snapshot.put( getIndex( elem, indexNode, i ), copy );
	}
	return snapshot;
	
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PersistentIndexedElementHolder.java

示例3: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final Map snap = (Map) getSnapshot();
	if ( snap.size()!= values.size() ) {
		return false;
	}
	for ( int i=0; i<values.size(); i++ ) {
		final Object value = values.get( i );
		final Object id = identifiers.get( i );
		if ( id == null ) {
			return false;
		}
		final Object old = snap.get( id );
		if ( elementType.isDirty( old, value, getSession() ) ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:PersistentIdentifierBag.java

示例4: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final List sn = (List) getSnapshot();
	if ( sn.size()!=this.list.size() ) {
		return false;
	}
	final Iterator itr = list.iterator();
	final Iterator snapshotItr = sn.iterator();
	while ( itr.hasNext() ) {
		if ( elementType.isDirty( itr.next(), snapshotItr.next(), getSession() ) ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PersistentList.java

示例5: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final Map snapshotMap = (Map) getSnapshot();
	if ( snapshotMap.size() != this.map.size() ) {
		return false;
	}

	for ( Object o : map.entrySet() ) {
		final Entry entry = (Entry) o;
		if ( elementType.isDirty( entry.getValue(), snapshotMap.get( entry.getKey() ), getSession() ) ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PersistentMap.java

示例6: needsRecreate

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean needsRecreate(CollectionPersister persister) {
	// Workaround for situations like HHH-7072.  If the collection element is a component that consists entirely
	// of nullable properties, we currently have to forcefully recreate the entire collection.  See the use
	// of hasNotNullableColumns in the AbstractCollectionPersister constructor for more info.  In order to delete
	// row-by-row, that would require SQL like "WHERE ( COL = ? OR ( COL is null AND ? is null ) )", rather than
	// the current "WHERE COL = ?" (fails for null for most DBs).  Note that
	// the param would have to be bound twice.  Until we eventually add "parameter bind points" concepts to the
	// AST in ORM 5+, handling this type of condition is either extremely difficult or impossible.  Forcing
	// recreation isn't ideal, but not really any other option in ORM 4.
	if (persister.getElementType() instanceof ComponentType) {
		ComponentType componentType = (ComponentType) persister.getElementType();
		return !componentType.hasNotNullProperty();
	}
	return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AbstractPersistentCollection.java

示例7: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final java.util.Map sn = (java.util.Map) getSnapshot();
	if ( sn.size()!=set.size() ) {
		return false;
	}
	else {
		for ( Object test : set ) {
			final Object oldValue = sn.get( test );
			if ( oldValue == null || elementType.isDirty( oldValue, test, getSession() ) ) {
				return false;
			}
		}
		return true;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:PersistentSet.java

示例8: 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

示例9: disassemble

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

示例10: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final ArrayList snapshot = (ArrayList) getSnapshot();
	final List elements = element.elements( persister.getElementNodeName() );
	if ( snapshot.size() != elements.size() ) {
		return false;
	}
	for ( int i=0; i<snapshot.size(); i++ ) {
		final Object old = snapshot.get( i );
		final Element elem = (Element) elements.get( i );
		final Object current = elementType.fromXMLNode( elem, persister.getFactory() );
		if ( elementType.isDirty( old, current, getSession() ) ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:PersistentElementHolder.java

示例11: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final String indexNode = getIndexAttributeName( persister );
	final HashMap snapshot = (HashMap) getSnapshot();
	final List elements = element.elements( persister.getElementNodeName() );

	if ( snapshot.size() !=  elements.size() ) {
		return false;
	}

	for ( int i=0; i<snapshot.size(); i++ ) {
		final Element elem = (Element) elements.get( i );
		final Object old = snapshot.get( getIndex( elem, indexNode, i ) );
		final Object current = elementType.fromXMLNode( elem, persister.getFactory() );
		if ( elementType.isDirty( old, current, getSession() ) ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:PersistentIndexedElementHolder.java

示例12: getDeletes

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"unchecked", "deprecation"})
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException {
	final Type elementType = persister.getElementType();
	final ArrayList snapshot = (ArrayList) getSnapshot();
	final List elements = element.elements( persister.getElementNodeName() );
	final ArrayList result = new ArrayList();
	for ( int i=0; i<snapshot.size(); i++ ) {
		final Object old = snapshot.get( i );
		if ( i >= elements.size() ) {
			result.add( old );
		}
		else {
			final Element elem = (Element) elements.get( i );
			final Object object = elementType.fromXMLNode( elem, persister.getFactory() );
			if ( elementType.isDirty( old, object, getSession() ) ) {
				result.add( old );
			}
		}
	}
	return result.iterator();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:PersistentElementHolder.java

示例13: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final List sn = (List) getSnapshot();
	if ( sn.size() != bag.size() ) {
		return false;
	}
	for ( Object elt : bag ) {
		final boolean unequal = countOccurrences( elt, bag, elementType ) != countOccurrences( elt, sn, elementType );
		if ( unequal ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:PersistentBag.java

示例14: equalsSnapshot

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final Serializable snapshot = getSnapshot();
	final int xlen = Array.getLength( snapshot );
	if ( xlen!= Array.getLength( array ) ) {
		return false;
	}
	for ( int i=0; i<xlen; i++) {
		if ( elementType.isDirty( Array.get( snapshot, i ), Array.get( array, i ), getSession() ) ) {
			return false;
		}
	}
	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:PersistentArrayHolder.java

示例15: initializeFromCache

import org.hibernate.persister.collection.CollectionPersister; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
		throws HibernateException {
	final Type elementType = persister.getElementType();
	final String indexNodeName = getIndexAttributeName( persister );
	final Serializable[] cached = (Serializable[]) disassembled;
	for ( int i=0; i<cached.length; i++ ) {
		final Object object = elementType.assemble( cached[i], getSession(), owner );
		final Element subelement = element.addElement( persister.getElementNodeName() );
		elementType.setToXMLNode( subelement, object, persister.getFactory() );
		setIndex( subelement, indexNodeName, Integer.toString( i ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:PersistentListElementHolder.java


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