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


Java Component.setKey方法代码示例

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


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

示例1: bindCompositeId

import org.hibernate.mapping.Component; //导入方法依赖的package包/类
public static void bindCompositeId(Element node, Component component,
		PersistentClass persistentClass, String propertyName, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {

	component.setKey( true );

	String path = StringHelper.qualify(
			persistentClass.getEntityName(),
			propertyName == null ? "id" : propertyName );

	bindComponent(
			node,
			component,
			persistentClass.getClassName(),
			propertyName,
			path,
			false,
			node.attribute( "class" ) == null
					&& propertyName == null,
			mappings,
			inheritedMetas,
			false
		);

	if ( "true".equals( node.attributeValue("mapped") ) ) {
		if ( propertyName!=null ) {
			throw new MappingException("cannot combine mapped=\"true\" with specified name");
		}
		Component mapper = new Component( mappings, persistentClass );
		bindComponent(
				node,
				mapper,
				persistentClass.getClassName(),
				null,
				path,
				false,
				true,
				mappings,
				inheritedMetas,
				true
			);
		persistentClass.setIdentifierMapper(mapper);
		Property property = new Property();
		property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
		property.setNodeName("id");
		property.setUpdateable(false);
		property.setInsertable(false);
		property.setValue(mapper);
		property.setPropertyAccessorName( "embedded" );
		persistentClass.addProperty(property);
	}

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

示例2: bindComponent

import org.hibernate.mapping.Component; //导入方法依赖的package包/类
private static PropertyBinder bindComponent(
		PropertyData inferredData,
		PropertyHolder propertyHolder,
		AccessType propertyAccessor,
		EntityBinder entityBinder,
		boolean isIdentifierMapper,
		Mappings mappings,
		boolean isComponentEmbedded,
		boolean isId, //is a identifier
		Map<XClass, InheritanceState> inheritanceStatePerClass,
		String referencedEntityName, //is a component who is overridden by a @MapsId
		Ejb3JoinColumn[] columns) {
	Component comp;
	if ( referencedEntityName != null ) {
		comp = createComponent( propertyHolder, inferredData, isComponentEmbedded, isIdentifierMapper, mappings );
		SecondPass sp = new CopyIdentifierComponentSecondPass(
				comp,
				referencedEntityName,
				columns,
				mappings
		);
		mappings.addSecondPass( sp );
	}
	else {
		comp = fillComponent(
				propertyHolder, inferredData, propertyAccessor, !isId, entityBinder,
				isComponentEmbedded, isIdentifierMapper,
				false, mappings, inheritanceStatePerClass
		);
	}
	if ( isId ) {
		comp.setKey( true );
		if ( propertyHolder.getPersistentClass().getIdentifier() != null ) {
			throw new AnnotationException(
					comp.getComponentClassName()
							+ " must not have @Id properties when used as an @EmbeddedId: "
							+ BinderHelper.getPath( propertyHolder, inferredData )
			);
		}
		if ( referencedEntityName == null && comp.getPropertySpan() == 0 ) {
			throw new AnnotationException(
					comp.getComponentClassName()
							+ " has no persistent id property: "
							+ BinderHelper.getPath( propertyHolder, inferredData )
			);
		}
	}
	XProperty property = inferredData.getProperty();
	setupComponentTuplizer( property, comp );
	PropertyBinder binder = new PropertyBinder();
	binder.setName( inferredData.getPropertyName() );
	binder.setValue( comp );
	binder.setProperty( inferredData.getProperty() );
	binder.setAccessType( inferredData.getDefaultAccess() );
	binder.setEmbedded( isComponentEmbedded );
	binder.setHolder( propertyHolder );
	binder.setId( isId );
	binder.setEntityBinder( entityBinder );
	binder.setInheritanceStatePerClass( inheritanceStatePerClass );
	binder.setMappings( mappings );
	binder.makePropertyAndBind();
	return binder;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:64,代码来源:AnnotationBinder.java

示例3: bindCompositeId

import org.hibernate.mapping.Component; //导入方法依赖的package包/类
public static void bindCompositeId(Element node, Component component,
		PersistentClass persistentClass, String propertyName, Mappings mappings,
		java.util.Map inheritedMetas) throws MappingException {

	component.setKey( true );

	String path = StringHelper.qualify(
			persistentClass.getEntityName(),
			propertyName == null ? "id" : propertyName );

	bindComponent(
			node,
			component,
			persistentClass.getClassName(),
			propertyName,
			path,
			false,
			node.attribute( "class" ) == null
					&& propertyName == null,
			mappings,
			inheritedMetas,
			false
		);

	if ( "true".equals( node.attributeValue("mapped") ) ) {
		if ( propertyName!=null ) {
			throw new MappingException("cannot combine mapped=\"true\" with specified name");
		}
		Component mapper = new Component(persistentClass);
		bindComponent(
				node,
				mapper,
				persistentClass.getClassName(),
				null,
				path,
				false,
				true,
				mappings,
				inheritedMetas,
				true
			);
		persistentClass.setIdentifierMapper(mapper);
		Property property = new Property();
		property.setName("_identifierMapper");
		property.setNodeName("id");
		property.setUpdateable(false);
		property.setInsertable(false);
		property.setValue(mapper);
		property.setPropertyAccessorName( "embedded" );
		persistentClass.addProperty(property);
	}

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


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