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


Java StringHelper.root方法代码示例

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


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

示例1: getSubclassPropertyTableNumber

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
 * Warning:
 * When there are duplicated property names in the subclasses
 * of the class, this method may return the wrong table
 * number for the duplicated subclass property (note that
 * SingleTableEntityPersister defines an overloaded form
 * which takes the entity name.
 */
public int getSubclassPropertyTableNumber(String propertyPath) {
	String rootPropertyName = StringHelper.root(propertyPath);
	Type type = propertyMapping.toType(rootPropertyName);
	if ( type.isAssociationType() ) {
		AssociationType assocType = ( AssociationType ) type;
		if ( assocType.useLHSPrimaryKey() ) {
			// performance op to avoid the array search
			return 0;
		}
		else if ( type.isCollectionType() ) {
			// properly handle property-ref-based associations
			rootPropertyName = assocType.getLHSPropertyName();
		}
	}
	//Enable for HHH-440, which we don't like:
	/*if ( type.isComponentType() && !propertyName.equals(rootPropertyName) ) {
		String unrooted = StringHelper.unroot(propertyName);
		int idx = ArrayHelper.indexOf( getSubclassColumnClosure(), unrooted );
		if ( idx != -1 ) {
			return getSubclassColumnTableNumberClosure()[idx];
		}
	}*/
	int index = ArrayHelper.indexOf( getSubclassPropertyNameClosure(), rootPropertyName); //TODO: optimize this better!
	return index==-1 ? 0 : getSubclassPropertyTableNumber(index);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:34,代码来源:AbstractEntityPersister.java

示例2: getWholeAssociationPath

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private String getWholeAssociationPath(CriteriaImpl.Subcriteria subcriteria) {
	String path = subcriteria.getPath();

	// some messy, complex stuff here, since createCriteria() can take an
	// aliased path, or a path rooted at the creating criteria instance
	Criteria parent = null;
	if ( path.indexOf( '.' ) > 0 ) {
		// if it is a compound path
		String testAlias = StringHelper.root( path );
		if ( !testAlias.equals( subcriteria.getAlias() ) ) {
			// and the qualifier is not the alias of this criteria
			//      -> check to see if we belong to some criteria other
			//          than the one that created us
			parent = ( Criteria ) aliasCriteriaMap.get( testAlias );
		}
	}
	if ( parent == null ) {
		// otherwise assume the parent is the the criteria that created us
		parent = subcriteria.getParent();
	}
	else {
		path = StringHelper.unroot( path );
	}

	if ( parent.equals( rootCriteria ) ) {
		// if its the root criteria, we are done
		return path;
	}
	else {
		// otherwise, recurse
		return getWholeAssociationPath( ( CriteriaImpl.Subcriteria ) parent ) + '.' + path;
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:34,代码来源:CriteriaQueryTranslator.java

示例3: getEntityName

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String getEntityName(Criteria subcriteria, String propertyName) {
	if ( propertyName.indexOf( '.' ) > 0 ) {
		String root = StringHelper.root( propertyName );
		Criteria crit = getAliasedCriteria( root );
		if ( crit != null ) {
			return getEntityName( crit );
		}
	}
	return getEntityName( subcriteria );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:CriteriaQueryTranslator.java

示例4: getSQLAlias

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String getSQLAlias(Criteria criteria, String propertyName) {
	if ( propertyName.indexOf( '.' ) > 0 ) {
		String root = StringHelper.root( propertyName );
		Criteria subcriteria = getAliasedCriteria( root );
		if ( subcriteria != null ) {
			return getSQLAlias( subcriteria );
		}
	}
	return getSQLAlias( criteria );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:CriteriaQueryTranslator.java

示例5: getPropertyName

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String getPropertyName(String propertyName) {
	if ( propertyName.indexOf( '.' ) > 0 ) {
		String root = StringHelper.root( propertyName );
		Criteria crit = getAliasedCriteria( root );
		if ( crit != null ) {
			return propertyName.substring( root.length() + 1 );
		}
	}
	return propertyName;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:CriteriaQueryTranslator.java

示例6: unalias

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
String unalias(String path) {
	String alias = StringHelper.root( path );
	String name = getAliasName( alias );
	if ( name != null ) {
		return name + path.substring( alias.length() );
	}
	else {
		return path;
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:QueryTranslatorImpl.java

示例7: getAlias

import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public static String getAlias(String path) {
	return StringHelper.root( path );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:4,代码来源:PathHelper.java


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