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


Java EntityType.getIdentifierOrUniqueKeyPropertyName方法代码示例

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


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

示例1: initIdentifierPropertyPaths

import org.hibernate.type.EntityType; //导入方法依赖的package包/类
protected void initIdentifierPropertyPaths(
		final String path,
		final EntityType etype,
		final String[] columns,
		final String[] columnReaders,
		final String[] columnReaderTemplates,
		final Mapping factory) throws MappingException {

	Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
	String idPropName = etype.getIdentifierOrUniqueKeyPropertyName(factory);
	boolean hasNonIdentifierPropertyNamedId = hasNonIdentifierPropertyNamedId( etype, factory );

	if ( etype.isReferenceToPrimaryKey() ) {
		if ( !hasNonIdentifierPropertyNamedId ) {
			String idpath1 = extendPath(path, EntityPersister.ENTITY_ID);
			addPropertyPath(idpath1, idtype, columns, columnReaders, columnReaderTemplates, null);
			initPropertyPaths(idpath1, idtype, columns, columnReaders, columnReaderTemplates, null, factory);
		}
	}

	if (idPropName!=null) {
		String idpath2 = extendPath(path, idPropName);
		addPropertyPath(idpath2, idtype, columns, columnReaders, columnReaderTemplates, null);
		initPropertyPaths(idpath2, idtype, columns, columnReaders, columnReaderTemplates, null, factory);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:AbstractPropertyMapping.java

示例2: initIdentifierPropertyPaths

import org.hibernate.type.EntityType; //导入方法依赖的package包/类
protected void initIdentifierPropertyPaths(
		final String path, 
		final EntityType etype, 
		final String[] columns, 
		final Mapping factory) throws MappingException {

	Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
	String idPropName = etype.getIdentifierOrUniqueKeyPropertyName(factory);
	boolean hasNonIdentifierPropertyNamedId = hasNonIdentifierPropertyNamedId( etype, factory );

	if ( etype.isReferenceToPrimaryKey() ) {
		if ( !hasNonIdentifierPropertyNamedId ) {
			String idpath1 = extendPath(path, EntityPersister.ENTITY_ID);
			addPropertyPath(idpath1, idtype, columns, null);
			initPropertyPaths(idpath1, idtype, columns, null, factory);
		}
	}

	if (idPropName!=null) {
		String idpath2 = extendPath(path, idPropName);
		addPropertyPath(idpath2, idtype, columns, null);
		initPropertyPaths(idpath2, idtype, columns, null, factory);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:25,代码来源:AbstractPropertyMapping.java

示例3: getIdentifierOrUniqueKeyPropertyName

import org.hibernate.type.EntityType; //导入方法依赖的package包/类
/**
 * Determine the name of the property for the entity encapsulated by the
 * given type which represents the id or unique-key.
 *
 * @param entityType The type representing the entity.
 * @return The corresponding property name
 * @throws QueryException Indicates such a property could not be found.
 */
public String getIdentifierOrUniqueKeyPropertyName(EntityType entityType) {
	try {
		return entityType.getIdentifierOrUniqueKeyPropertyName( sfi );
	}
	catch ( MappingException me ) {
		throw new QueryException( me );
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:17,代码来源:SessionFactoryHelper.java

示例4: dereferenceEntity

import org.hibernate.type.EntityType; //导入方法依赖的package包/类
private void dereferenceEntity(String propertyName, EntityType propertyType, QueryTranslatorImpl q)
		throws QueryException {
	//NOTE: we avoid joining to the next table if the named property is just the foreign key value

	//if its "id"
	boolean isIdShortcut = EntityPersister.ENTITY_ID.equals( propertyName ) &&
			propertyType.isReferenceToPrimaryKey();

	//or its the id property name
	final String idPropertyName;
	try {
		idPropertyName = propertyType.getIdentifierOrUniqueKeyPropertyName( q.getFactory() );
	}
	catch ( MappingException me ) {
		throw new QueryException( me );
	}
	boolean isNamedIdPropertyShortcut = idPropertyName != null
			&& idPropertyName.equals( propertyName )
			&& propertyType.isReferenceToPrimaryKey();

	if ( isIdShortcut || isNamedIdPropertyShortcut ) {
		// special shortcut for id properties, skip the join!
		// this must only occur at the _end_ of a path expression
		if ( componentPath.length() > 0 ) componentPath.append( '.' );
		componentPath.append( propertyName );
	}
	else {
		String entityClass = propertyType.getAssociatedEntityName();
		String name = q.createNameFor( entityClass );
		q.addType( name, entityClass );
		addJoin( name, propertyType );
		if ( propertyType.isOneToOne() ) oneToOneOwnerName = currentName;
		ownerAssociationType = propertyType;
		currentName = name;
		currentProperty = propertyName;
		q.addPathAliasAndJoin( path.substring( 0, path.toString().lastIndexOf( '.' ) ), name, joinSequence.copy() );
		componentPath.setLength( 0 );
		currentPropertyMapping = q.getEntityPersister( entityClass );
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:41,代码来源:PathExpressionParser.java

示例5: dereferenceEntity

import org.hibernate.type.EntityType; //导入方法依赖的package包/类
private void dereferenceEntity(String propertyName, EntityType propertyType, QueryTranslatorImpl q)
		throws QueryException {
	//NOTE: we avoid joining to the next table if the named property is just the foreign key value

	//if its "id"
	boolean isIdShortcut = EntityPersister.ENTITY_ID.equals( propertyName ) &&
			propertyType.isReferenceToPrimaryKey();

	//or its the id property name
	final String idPropertyName;
	try {
		idPropertyName = propertyType.getIdentifierOrUniqueKeyPropertyName( q.getFactory() );
	}
	catch ( MappingException me ) {
		throw new QueryException( me );
	}
	boolean isNamedIdPropertyShortcut = idPropertyName != null
			&& idPropertyName.equals( propertyName )
			&& propertyType.isReferenceToPrimaryKey();


	if ( isIdShortcut || isNamedIdPropertyShortcut ) {
		// special shortcut for id properties, skip the join!
		// this must only occur at the _end_ of a path expression
		if ( componentPath.length() > 0 ) componentPath.append( '.' );
		componentPath.append( propertyName );
	}
	else {
		String entityClass = propertyType.getAssociatedEntityName();
		String name = q.createNameFor( entityClass );
		q.addType( name, entityClass );
		addJoin( name, propertyType );
		if ( propertyType.isOneToOne() ) oneToOneOwnerName = currentName;
		ownerAssociationType = propertyType;
		currentName = name;
		currentProperty = propertyName;
		q.addPathAliasAndJoin( path.substring( 0, path.toString().lastIndexOf( '.' ) ), name, joinSequence.copy() );
		componentPath.setLength( 0 );
		currentPropertyMapping = q.getEntityPersister( entityClass );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:PathExpressionParser.java

示例6: getIdentifierOrUniqueKeyPropertyName

import org.hibernate.type.EntityType; //导入方法依赖的package包/类
/**
 * Determine the name of the property for the entity encapsulated by the
 * given type which represents the id or unique-key.
 *
 * @param entityType The type representing the entity.
 *
 * @return The corresponding property name
 *
 * @throws QueryException Indicates such a property could not be found.
 */
public String getIdentifierOrUniqueKeyPropertyName(EntityType entityType) {
	try {
		return entityType.getIdentifierOrUniqueKeyPropertyName( sfi );
	}
	catch ( MappingException me ) {
		throw new QueryException( me );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:SessionFactoryHelper.java


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