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


Java RootClass.getIdentifier方法代码示例

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


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

示例1: bind

import org.hibernate.mapping.RootClass; //导入方法依赖的package包/类
private Property bind(Property prop) {
	if (isId) {
		final RootClass rootClass = ( RootClass ) holder.getPersistentClass();
		//if an xToMany, it as to be wrapped today.
		//FIXME this pose a problem as the PK is the class instead of the associated class which is not really compliant with the spec
		if ( isXToMany || entityBinder.wrapIdsInEmbeddedComponents() ) {
			Component identifier = (Component) rootClass.getIdentifier();
			if (identifier == null) {
				identifier = AnnotationBinder.createComponent( holder, new PropertyPreloadedData(null, null, null), true, false, mappings );
				rootClass.setIdentifier( identifier );
				identifier.setNullValue( "undefined" );
				rootClass.setEmbeddedIdentifier( true );
				rootClass.setIdentifierMapper( identifier );
			}
			//FIXME is it good enough?
			identifier.addProperty( prop );
		}
		else {
			rootClass.setIdentifier( ( KeyValue ) getValue() );
			if (embedded) {
				rootClass.setEmbeddedIdentifier( true );
			}
			else {
				rootClass.setIdentifierProperty( prop );
				final org.hibernate.mapping.MappedSuperclass superclass = BinderHelper.getMappedSuperclassOrNull(
						declaringClass,
						inheritanceStatePerClass,
						mappings
				);
				if (superclass != null) {
					superclass.setDeclaredIdentifierProperty(prop);
				}
				else {
					//we know the property is on the actual entity
					rootClass.setDeclaredIdentifierProperty( prop );
				}
			}
		}
	}
	else {
		holder.addProperty( prop, columns, declaringClass );
	}
	return prop;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:PropertyBinder.java

示例2: interpretIdentifierDescriptor

import org.hibernate.mapping.RootClass; //导入方法依赖的package包/类
private static IdentifierDescriptor interpretIdentifierDescriptor(
			EntityHierarchyImpl hierarchy,
			EntityPersister rootEntityPersister,
			PersisterCreationContext creationContext,
			RootClass rootEntityBinding,
			Table identifierTable) {
		final KeyValue identifierValueMapping = rootEntityBinding.getIdentifier();

		final List<Column> idColumns = resolveColumns( identifierTable, identifierValueMapping, creationContext );

		if ( identifierValueMapping.getType() instanceof org.hibernate.type.BasicType ) {
			return new IdentifierDescriptorSimpleImpl(
					hierarchy.getRootEntityPersister(),
					rootEntityBinding.getIdentifierProperty().getName(),
					OrmTypeHelper.convertBasic(
							(org.hibernate.type.BasicType) identifierValueMapping.getType(),
							creationContext.getTypeConfiguration()
					),
					idColumns
			);
		}
		else {
			final CompositeType cidType = (CompositeType) identifierValueMapping.getType();
			// todo : need to pass along that any built sub attributes are part of the id
			if ( rootEntityBinding.hasIdentifierProperty() ) {
				return new IdentifierDescriptorAggregatedEmbeddedImpl(
						(SingularAttributeEmbedded) PersisterHelper.INSTANCE.buildSingularAttribute(
								creationContext,
								// the declaring type...
								///		for now we use the root entity
								hierarchy.getRootEntityPersister(),
								// value?
								null,
								rootEntityBinding.getIdentifierProperty().getName(),
								OrmTypeHelper.convertComposite(
										creationContext,
										rootEntityBinding.getIdentifierProperty().getName(),
										(Component) identifierValueMapping,
										hierarchy.getRootEntityPersister(),
										creationContext.getTypeConfiguration()
								),
								idColumns
						)
				);
			}
			else {
				// todo : pass info about ther IdClass
				return new IdentifierDescriptorNonAggregatedEmbeddedImpl(
						rootEntityPersister,
						OrmTypeHelper.convertComposite(
								creationContext,
								"<id>",
								(Component) identifierValueMapping,
								hierarchy.getRootEntityPersister(),
								creationContext.getTypeConfiguration()
						),
						OrmTypeHelper.convertComposite(
								creationContext,
								"<IdClass>",
								rootEntityBinding.getIdentifierMapper(),
								hierarchy.getRootEntityPersister(),
								creationContext.getTypeConfiguration()
						)
				);

//						PersisterHelper.INSTANCE.buildEmbeddablePersister(
//								creationContext,
//								hierarchy.getRootEntityPersister(),
//								rootEntityBinding.getEntityName() + ".id",
//								cidType,
//								idColumns
//						)
			}
		}
	}
 
开发者ID:hibernate,项目名称:hibernate-semantic-query,代码行数:76,代码来源:EntityHierarchyImpl.java


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