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


Java Type.isComponentType方法代码示例

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


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

示例1: initCollectionPropertyMap

import org.hibernate.type.Type; //导入方法依赖的package包/类
private void initCollectionPropertyMap(String aliasName, Type type, String[] columnAliases, String[] columnNames) {

		collectionPropertyColumnAliases.put( aliasName, columnAliases );
		collectionPropertyColumnNames.put( aliasName, columnNames );

		if ( type.isComponentType() ) {
			CompositeType ct = (CompositeType) type;
			String[] propertyNames = ct.getPropertyNames();
			for ( int i = 0; i < propertyNames.length; i++ ) {
				String name = propertyNames[i];
				collectionPropertyColumnAliases.put( aliasName + "." + name, columnAliases[i] );
				collectionPropertyColumnNames.put( aliasName + "." + name, columnNames[i] );
			}
		}

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

示例2: addComponentTypedValues

import org.hibernate.type.Type; //导入方法依赖的package包/类
protected void addComponentTypedValues(
		String path, 
		Object component, 
		CompositeType type,
		List<TypedValue> list,
		Criteria criteria, 
		CriteriaQuery criteriaQuery) {
	if ( component != null ) {
		final String[] propertyNames = type.getPropertyNames();
		final Type[] subtypes = type.getSubtypes();
		final Object[] values = type.getPropertyValues( component, getEntityMode( criteria, criteriaQuery ) );
		for ( int i=0; i<propertyNames.length; i++ ) {
			final Object value = values[i];
			final Type subtype = subtypes[i];
			final String subpath = StringHelper.qualify( path, propertyNames[i] );
			if ( isPropertyIncluded( value, subpath, subtype ) ) {
				if ( subtype.isComponentType() ) {
					addComponentTypedValues( subpath, value, (CompositeType) subtype, list, criteria, criteriaQuery );
				}
				else {
					addPropertyTypedValue( value, subtype, list );
				}
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:Example.java

示例3: decode

import org.hibernate.type.Type; //导入方法依赖的package包/类
private static NonIdentifierAttributeNature decode(Type type) {
	if ( type.isAssociationType() ) {
		AssociationType associationType = (AssociationType) type;

		if ( type.isComponentType() ) {
			// an any type is both an association and a composite...
			return NonIdentifierAttributeNature.ANY;
		}

		return type.isCollectionType()
				? NonIdentifierAttributeNature.COLLECTION
				: NonIdentifierAttributeNature.ENTITY;
	}
	else {
		if ( type.isComponentType() ) {
			return NonIdentifierAttributeNature.COMPOSITE;
		}

		return NonIdentifierAttributeNature.BASIC;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PropertyFactory.java

示例4: isIdProperty

import org.hibernate.type.Type; //导入方法依赖的package包/类
/**
 * Check if the property is part of the identifier of the entity.
 *
 * @param persister the {@link OgmEntityPersister} of the entity with the property
 * @param namesWithoutAlias the path to the property with all the aliases resolved
 * @return {@code true} if the property is part of the id, {@code false} otherwise.
 */
public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) {
	String join = StringHelper.join( namesWithoutAlias, "." );
	Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) );
	String[] identifierColumnNames = persister.getIdentifierColumnNames();
	if ( propertyType.isComponentType() ) {
		String[] embeddedColumnNames = persister.getPropertyColumnNames( join );
		for ( String embeddedColumn : embeddedColumnNames ) {
			if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) {
				return false;
			}
		}
		return true;
	}
	return ArrayHelper.contains( identifierColumnNames, join );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:23,代码来源:IgnitePropertyHelper.java

示例5: processValue

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

示例6: finishingCollectionElements

import org.hibernate.type.Type; //导入方法依赖的package包/类
@Override
public void finishingCollectionElements(CollectionElementDefinition elementDefinition) {
	final Type elementType = elementDefinition.getType();

	if ( elementType.isAnyType() ) {
		// nothing to do because the element graph was not pushed in #startingCollectionElement..
	}
	else if ( elementType.isComponentType() || elementType.isAssociationType()) {
		// pop it from the stack
		final ExpandingFetchSource popped = popFromStack();

		// validation
		if ( ! CollectionFetchableElement.class.isInstance( popped ) ) {
			throw new WalkingException( "Mismatched FetchSource from stack on pop" );
		}
	}

	log.tracef(
			"%s Finished collection element graph : %s",
			StringHelper.repeat( "<<", fetchSourceStack.size() ),
			elementDefinition.getCollectionDefinition().getCollectionPersister().getRole()
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AbstractLoadPlanBuildingAssociationVisitationStrategy.java

示例7: startingAttribute

import org.hibernate.type.Type; //导入方法依赖的package包/类
@Override
public boolean startingAttribute(AttributeDefinition attributeDefinition) {
	log.tracef(
			"%s Starting attribute %s",
			StringHelper.repeat( ">>", fetchSourceStack.size() ),
			attributeDefinition
	);

	final Type attributeType = attributeDefinition.getType();

	final boolean isComponentType = attributeType.isComponentType();
	final boolean isAssociationType = attributeType.isAssociationType();
	final boolean isBasicType = ! ( isComponentType || isAssociationType );
	currentPropertyPath = currentPropertyPath.append( attributeDefinition.getName() );
	if ( isBasicType ) {
		return true;
	}
	else if ( isAssociationType ) {
		// also handles any type attributes...
		return handleAssociationAttribute( (AssociationAttributeDefinition) attributeDefinition );
	}
	else {
		return handleCompositeAttribute( attributeDefinition );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:AbstractLoadPlanBuildingAssociationVisitationStrategy.java

示例8: prepareEntityIdentifierDefinition

import org.hibernate.type.Type; //导入方法依赖的package包/类
private void prepareEntityIdentifierDefinition() {
	if ( entityIdentifierDefinition != null ) {
		return;
	}
	final Type idType = getIdentifierType();

	if ( !idType.isComponentType() ) {
		entityIdentifierDefinition =
				EntityIdentifierDefinitionHelper.buildSimpleEncapsulatedIdentifierDefinition( this );
		return;
	}

	final CompositeType cidType = (CompositeType) idType;
	if ( !cidType.isEmbedded() ) {
		entityIdentifierDefinition =
				EntityIdentifierDefinitionHelper.buildEncapsulatedCompositeIdentifierDefinition( this );
		return;
	}

	entityIdentifierDefinition =
			EntityIdentifierDefinitionHelper.buildNonEncapsulatedCompositeIdentifierDefinition( this );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AbstractEntityPersister.java

示例9: getCascadeStyle

import org.hibernate.type.Type; //导入方法依赖的package包/类
public CascadeStyle getCascadeStyle() throws MappingException {
	Type type = value.getType();
	if ( type.isComponentType() ) {
		return getCompositeCascadeStyle( (CompositeType) type, cascade );
	}
	else if ( type.isCollectionType() ) {
		return getCollectionCascadeStyle( ( (Collection) value ).getElement().getType(), cascade );
	}
	else {
		return getCascadeStyle( cascade );			
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:Property.java

示例10: getCollectionCascadeStyle

import org.hibernate.type.Type; //导入方法依赖的package包/类
private static CascadeStyle getCollectionCascadeStyle(Type elementType, String cascade) {
	if ( elementType.isComponentType() ) {
		return getCompositeCascadeStyle( (CompositeType) elementType, cascade );
	}
	else {
		return getCascadeStyle( cascade );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:Property.java

示例11: appendComponentCondition

import org.hibernate.type.Type; //导入方法依赖的package包/类
protected void appendComponentCondition(
		String path,
		Object component,
		CompositeType type,
		Criteria criteria,
		CriteriaQuery criteriaQuery,
		StringBuilder buf) {
	if ( component != null ) {
		final String[] propertyNames = type.getPropertyNames();
		final Object[] values = type.getPropertyValues( component, getEntityMode( criteria, criteriaQuery ) );
		final Type[] subtypes = type.getSubtypes();
		for ( int i=0; i<propertyNames.length; i++ ) {
			final String subPath = StringHelper.qualify( path, propertyNames[i] );
			final Object value = values[i];
			if ( isPropertyIncluded( value, subPath, subtypes[i] ) ) {
				final Type subtype = subtypes[i];
				if ( subtype.isComponentType() ) {
					appendComponentCondition(
							subPath,
							value,
							(CompositeType) subtype,
							criteria,
							criteriaQuery,
							buf
					);
				}
				else {
					appendPropertyCondition(
							subPath,
							value,
							criteria,
							criteriaQuery,
							buf
					);
				}
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:Example.java

示例12: hasAssociation

import org.hibernate.type.Type; //导入方法依赖的package包/类
private boolean hasAssociation(CompositeType componentType) {
	for ( Type subType : componentType.getSubtypes() ) {
		if ( subType.isEntityType() ) {
			return true;
		}
		else if ( subType.isComponentType() && hasAssociation( ( (CompositeType) subType ) ) ) {
			return true;
		}
	}
	return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:EntityJoinWalker.java

示例13: resolveAsNakedComponentPropertyRefLHS

import org.hibernate.type.Type; //导入方法依赖的package包/类
private boolean resolveAsNakedComponentPropertyRefLHS(DotNode parent) {
	FromElement fromElement = locateSingleFromElement();
	if (fromElement == null) {
		return false;
	}

	Type componentType = getNakedPropertyType(fromElement);
	if ( componentType == null ) {
		throw new QueryException( "Unable to resolve path [" + parent.getPath() + "], unexpected token [" + getOriginalText() + "]" );
	}
	if (!componentType.isComponentType()) {
		throw new QueryException("Property '" + getOriginalText() + "' is not a component.  Use an alias to reference associations or collections.");
	}

	Type propertyType;
	String propertyPath = getText() + "." + getNextSibling().getText();
	try {
		// check to see if our "propPath" actually
		// represents a property on the persister
		propertyType = fromElement.getPropertyType(getText(), propertyPath);
	}
	catch (Throwable t) {
		// assume we do *not* refer to a property on the given persister
		return false;
	}

	setFromElement(fromElement);
	parent.setPropertyPath(propertyPath);
	parent.setDataType(propertyType);

	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:IdentNode.java

示例14: addKeyManyToOnesToSession

import org.hibernate.type.Type; //导入方法依赖的package包/类
private void addKeyManyToOnesToSession(ResultSetProcessingContextImpl context, ComponentType componentType, Object component ) {
	for ( int i = 0 ; i < componentType.getSubtypes().length ; i++ ) {
		final Type subType = componentType.getSubtypes()[ i ];
		final Object subValue = componentType.getPropertyValue( component, i, context.getSession() );
		if ( subType.isEntityType() ) {
			( (Session) context.getSession() ).buildLockRequest( LockOptions.NONE ).lock( subValue );
		}
		else if ( subType.isComponentType() ) {
			addKeyManyToOnesToSession( context, (ComponentType) subType, subValue  );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:EntityLoadQueryDetails.java

示例15: nullifyTransientReferences

import org.hibernate.type.Type; //导入方法依赖的package包/类
/**
 * Return null if the argument is an "unsaved" entity (ie. one with no existing database row), or the
 * input argument otherwise.  This is how Hibernate avoids foreign key constraint violations.
 *
 * @param value An entity attribute value
 * @param type An entity attribute type
 *
 * @return {@code null} if the argument is an unsaved entity; otherwise return the argument.
 */
private Object nullifyTransientReferences(final Object value, final Type type) {
	if ( value == null ) {
		return null;
	}
	else if ( type.isEntityType() ) {
		final EntityType entityType = (EntityType) type;
		if ( entityType.isOneToOne() ) {
			return value;
		}
		else {
			final String entityName = entityType.getAssociatedEntityName();
			return isNullifiable( entityName, value ) ? null : value;
		}
	}
	else if ( type.isAnyType() ) {
		return isNullifiable( null, value ) ? null : value;
	}
	else if ( type.isComponentType() ) {
		final CompositeType actype = (CompositeType) type;
		final Object[] subvalues = actype.getPropertyValues( value, session );
		final Type[] subtypes = actype.getSubtypes();
		boolean substitute = false;
		for ( int i = 0; i < subvalues.length; i++ ) {
			final Object replacement = nullifyTransientReferences( subvalues[i], subtypes[i] );
			if ( replacement != subvalues[i] ) {
				substitute = true;
				subvalues[i] = replacement;
			}
		}
		if ( substitute ) {
			// todo : need to account for entity mode on the CompositeType interface :(
			actype.setPropertyValues( value, subvalues, EntityMode.POJO );
		}
		return value;
	}
	else {
		return value;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:49,代码来源:ForeignKeys.java


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