本文整理汇总了Java中org.hibernate.util.StringHelper.qualify方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.qualify方法的具体用法?Java StringHelper.qualify怎么用?Java StringHelper.qualify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.util.StringHelper
的用法示例。
在下文中一共展示了StringHelper.qualify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public void validate(Mapping mapping) throws MappingException {
Iterator iter = getPropertyIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
if ( !prop.isValid(mapping) ) {
throw new MappingException(
"property mapping has wrong number of columns: " +
StringHelper.qualify( getEntityName(), prop.getName() ) +
" type: " +
prop.getType().getName()
);
}
}
checkPropertyDuplication();
checkColumnDuplication();
}
示例2: createJoin
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
protected JoinFragment createJoin(String name, boolean innerJoin, boolean includeSubclasses) {
final String[] idCols = StringHelper.qualify( name, getIdentifierColumnNames() ); //all joins join to the pk of the driving table
final JoinFragment join = getFactory().getDialect().createOuterJoinFragment();
final int tableSpan = getSubclassTableSpan();
for ( int j = 1; j < tableSpan; j++ ) { //notice that we skip the first table; it is the driving table!
final boolean joinIsIncluded = isClassOrSuperclassTable( j ) ||
( includeSubclasses && !isSubclassTableSequentialSelect( j ) && !isSubclassTableLazy( j ) );
if ( joinIsIncluded ) {
join.addJoin( getSubclassTableName( j ),
generateTableAlias( name, j ),
idCols,
getSubclassTableKeyColumns( j ),
innerJoin && isClassOrSuperclassTable( j ) && !isInverseTable( j ) && !isNullableTable( j ) ?
JoinFragment.INNER_JOIN : //we can inner join to superclass tables (the row MUST be there)
JoinFragment.LEFT_OUTER_JOIN //we can never inner join to subclass tables
);
}
}
return join;
}
示例3: toColumns
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String[] toColumns(String alias, String propertyName) throws QueryException {
//TODO: *two* hashmap lookups here is one too many...
String[] columns = (String[]) columnsByPropertyPath.get(propertyName);
if ( columns == null ) {
throw propertyException( propertyName );
}
String[] templates = (String[]) formulaTemplatesByPropertyPath.get(propertyName);
String[] result = new String[columns.length];
for ( int i=0; i<columns.length; i++ ) {
if ( columns[i]==null ) {
result[i] = StringHelper.replace( templates[i], Template.TEMPLATE, alias );
}
else {
result[i] = StringHelper.qualify( alias, columns[i] );
}
}
return result;
}
示例4: getAliasedLHSColumnNames
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Get the aliased columns of the owning entity which are to
* be used in the join
*/
public static String[] getAliasedLHSColumnNames(
AssociationType type,
String alias,
int property,
int begin,
OuterJoinLoadable lhsPersister,
Mapping mapping
) {
if ( type.useLHSPrimaryKey() ) {
return StringHelper.qualify( alias, lhsPersister.getIdentifierColumnNames() );
}
else {
String propertyName = type.getLHSPropertyName();
if (propertyName==null) {
return ArrayHelper.slice(
lhsPersister.toColumns(alias, property),
begin,
type.getColumnSpan(mapping)
);
}
else {
return ( (PropertyMapping) lhsPersister ).toColumns(alias, propertyName); //bad cast
}
}
}
示例5: sqlDropString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String sqlDropString(Dialect dialect, String defaultCatalog, String defaultSchema) {
return "drop index " +
StringHelper.qualify(
table.getQualifiedName( dialect, defaultCatalog, defaultSchema ),
name
);
}
示例6: subPath
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Extend the path by the given property name
*/
private static String subPath(String path, String property) {
if ( path==null || path.length()==0) {
return property;
}
else {
return StringHelper.qualify(path, property);
}
}
示例7: generateGeneratedValuesSelectString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private String generateGeneratedValuesSelectString(ValueInclusion[] inclusions) {
Select select = new Select( getFactory().getDialect() );
if ( getFactory().getSettings().isCommentsEnabled() ) {
select.setComment( "get generated state " + getEntityName() );
}
String[] aliasedIdColumns = StringHelper.qualify( getRootAlias(), getIdentifierColumnNames() );
// Here we render the select column list based on the properties defined as being generated.
// For partial component generation, we currently just re-select the whole component
// rather than trying to handle the individual generated portions.
String selectClause = concretePropertySelectFragment( getRootAlias(), inclusions );
selectClause = selectClause.substring( 2 );
String fromClause = fromTableFragment( getRootAlias() ) +
fromJoinFragment( getRootAlias(), true, false );
String whereClause = new StringBuffer()
.append( StringHelper.join( "=? and ", aliasedIdColumns ) )
.append( "=?" )
.append( whereJoinFragment( getRootAlias(), true, false ) )
.toString();
return select.setSelectClause( selectClause )
.setFromClause( fromClause )
.setOuterJoins( "", "" )
.setWhereClause( whereClause )
.toStatementString();
}
示例8: generateSnapshotSelectString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
protected String generateSnapshotSelectString() {
//TODO: should we use SELECT .. FOR UPDATE?
Select select = new Select( getFactory().getDialect() );
if ( getFactory().getSettings().isCommentsEnabled() ) {
select.setComment( "get current state " + getEntityName() );
}
String[] aliasedIdColumns = StringHelper.qualify( getRootAlias(), getIdentifierColumnNames() );
String selectClause = StringHelper.join( ", ", aliasedIdColumns ) +
concretePropertySelectFragment( getRootAlias(), getPropertyUpdateability() );
String fromClause = fromTableFragment( getRootAlias() ) +
fromJoinFragment( getRootAlias(), true, false );
String whereClause = new StringBuffer()
.append( StringHelper.join( "=? and ",
aliasedIdColumns ) )
.append( "=?" )
.append( whereJoinFragment( getRootAlias(), true, false ) )
.toString();
/*if ( isVersioned() ) {
where.append(" and ")
.append( getVersionColumnName() )
.append("=?");
}*/
return select.setSelectClause( selectClause )
.setFromClause( fromClause )
.setOuterJoins( "", "" )
.setWhereClause( whereClause )
.toStatementString();
}
示例9: toColumns
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String[] toColumns(String name, final int i) {
final String alias = generateTableAlias( name, getSubclassPropertyTableNumber( i ) );
String[] cols = getSubclassPropertyColumnNames( i );
String[] templates = getSubclassPropertyFormulaTemplateClosure()[i];
String[] result = new String[cols.length];
for ( int j = 0; j < cols.length; j++ ) {
if ( cols[j] == null ) {
result[j] = StringHelper.replace( templates[j], Template.TEMPLATE, alias );
}
else {
result[j] = StringHelper.qualify( alias, cols[j] );
}
}
return result;
}
示例10: ForUpdateFragment
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public ForUpdateFragment(Dialect dialect, Map lockModes, Map keyColumnNames) throws QueryException {
this( dialect );
LockMode upgradeType = null;
Iterator iter = lockModes.entrySet().iterator();
while ( iter.hasNext() ) {
final Map.Entry me = ( Map.Entry ) iter.next();
final LockMode lockMode = ( LockMode ) me.getValue();
if ( LockMode.READ.lessThan( lockMode ) ) {
final String tableAlias = ( String ) me.getKey();
if ( dialect.forUpdateOfColumns() ) {
String[] keyColumns = ( String[] ) keyColumnNames.get( tableAlias ); //use the id column alias
if ( keyColumns == null ) {
throw new IllegalArgumentException( "alias not found: " + tableAlias );
}
keyColumns = StringHelper.qualify( tableAlias, keyColumns );
for ( int i = 0; i < keyColumns.length; i++ ) {
addTableAlias( keyColumns[i] );
}
}
else {
addTableAlias( tableAlias );
}
if ( upgradeType != null && lockMode != upgradeType ) {
throw new QueryException( "mixed LockModes" );
}
upgradeType = lockMode;
}
}
if ( upgradeType == LockMode.UPGRADE_NOWAIT ) {
setNowaitEnabled( true );
}
}
示例11: toColumns
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String[] toColumns(String alias, String propertyName) throws QueryException {
if (propertyName==null || "id".equals(propertyName) ) {
return StringHelper.qualify(alias, elementColumns);
}
else {
throw new QueryException("cannot dereference scalar collection element: " + propertyName);
}
}
示例12: qualify
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private static String[] qualify(String alias, String[] columnNames, String[] formulaTemplates) {
int span = columnNames.length;
String[] result = new String[span];
for (int i=0; i<span; i++) {
if ( columnNames[i]==null ) {
result[i] = StringHelper.replace( formulaTemplates[i], Template.TEMPLATE, alias );
}
else {
result[i] = StringHelper.qualify( alias, columnNames[i] );
}
}
return result;
}
示例13: toSubselectString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSubselectString(String ukname) {
String[] joinColumns = ukname==null ?
StringHelper.qualify( alias, loadable.getIdentifierColumnNames() ) :
( (PropertyMapping) loadable ).toColumns(alias, ukname);
return new StringBuffer()
.append("select ")
.append( StringHelper.join(", ", joinColumns) )
.append(queryString)
.toString();
}
示例14: getDropIndexSql
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
@Override
public String getDropIndexSql(String table, String indexName)
{
return "drop index " + StringHelper.qualify(table, quote(indexName));
}
示例15: bindCompositeId
import org.hibernate.util.StringHelper; //导入方法依赖的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);
}
}