本文整理汇总了Java中org.hibernate.util.StringHelper.join方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.join方法的具体用法?Java StringHelper.join怎么用?Java StringHelper.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.util.StringHelper
的用法示例。
在下文中一共展示了StringHelper.join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAddForeignKeyConstraintString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String getAddForeignKeyConstraintString(
String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey, boolean referencesPrimaryKey
) {
String cols = StringHelper.join(", ", foreignKey);
return new StringBuffer(30)
.append(" add index ")
.append(constraintName)
.append(" (")
.append(cols)
.append("), add constraint ")
.append(constraintName)
.append(" foreign key (")
.append(cols)
.append(") references ")
.append(referencedTable)
.append(" (")
.append( StringHelper.join(", ", primaryKey) )
.append(')')
.toString();
}
示例2: getIdentityColumn
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String getIdentityColumn() {
checkInitialized();
String table = getTableAlias();
if ( table == null ) {
throw new IllegalStateException( "No table alias for node " + this );
}
String[] cols;
String propertyName;
if ( getEntityPersister() != null && getEntityPersister().getEntityMetamodel() != null
&& getEntityPersister().getEntityMetamodel().hasNonIdentifierPropertyNamedId() ) {
propertyName = getEntityPersister().getIdentifierPropertyName();
}
else {
propertyName = EntityPersister.ENTITY_ID;
}
if ( getWalker().getStatementType() == HqlSqlWalker.SELECT ) {
cols = getPropertyMapping( propertyName ).toColumns( table, propertyName );
}
else {
cols = getPropertyMapping( propertyName ).toColumns( propertyName );
}
String result = StringHelper.join( ", ", cols );
return cols.length == 1 ? result : "(" + result + ")";
}
示例3: toSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
return StringHelper.join(
" and ",
StringHelper.suffix( criteriaQuery.getColumnsUsingProjection(criteria, propertyName), " between ? and ?" )
);
//TODO: get SQL rendering out of this package!
}
示例4: toSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
String result = StringHelper.join(
" or ",
StringHelper.suffix( columns, " is not null" )
);
if (columns.length>1) result = '(' + result + ')';
return result;
//TODO: get SQL rendering out of this package!
}
示例5: toSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
String[] columns = criteriaQuery.getIdentifierColumns(criteria);
String result = StringHelper.join(
" and ",
StringHelper.suffix( columns, " = ?" )
);
if (columns.length>1) result = '(' + result + ')';
return result;
//TODO: get SQL rendering out of this package!
}
示例6: toSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
String singleValueParam = StringHelper.repeat( "?, ", columns.length-1 ) + "?";
if ( columns.length>1 ) singleValueParam = '(' + singleValueParam + ')';
String params = values.length>0 ?
StringHelper.repeat( singleValueParam + ", ", values.length-1 ) + singleValueParam :
"";
String cols = StringHelper.join(", ", columns);
if ( columns.length>1 ) cols = '(' + cols + ')';
return cols + " in (" + params + ')';
}
示例7: toSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
String result = StringHelper.join(
" and ",
StringHelper.suffix( columns, " is null" )
);
if (columns.length>1) result = '(' + result + ')';
return result;
//TODO: get SQL rendering out of this package!
}
示例8: toGroupSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
if (!grouped) {
return super.toGroupSqlString(criteria, criteriaQuery);
}
else {
return StringHelper.join( ", ", criteriaQuery.getIdentifierColumns(criteria) );
}
}
示例9: toSqlString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
String[] xcols = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
String[] ycols = criteriaQuery.getColumnsUsingProjection(criteria, otherPropertyName);
String result = StringHelper.join(
" and ",
StringHelper.add(xcols, getOp(), ycols)
);
if (xcols.length>1) result = '(' + result + ')';
return result;
//TODO: get SQL rendering out of this package!
}
示例10: 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();
}
示例11: initText
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private void initText() {
String[] cols = getColumns();
String text = StringHelper.join( ", ", cols );
if ( cols.length > 1 && getWalker().isComparativeExpressionClause() ) {
text = "(" + text + ")";
}
setText( text );
}
示例12: resolveAsNakedPropertyRef
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private int resolveAsNakedPropertyRef() {
FromElement fromElement = locateSingleFromElement();
if (fromElement == null) {
return UNKNOWN;
}
Queryable persister = fromElement.getQueryable();
if (persister == null) {
return UNKNOWN;
}
Type propertyType = getNakedPropertyType(fromElement);
if (propertyType == null) {
// assume this ident's text does *not* refer to a property on the given persister
return UNKNOWN;
}
if ((propertyType.isComponentType() || propertyType.isAssociationType() )) {
return COMPONENT_REF;
}
setFromElement(fromElement);
String property = getText();
String[] columns = getWalker().isSelectStatement()
? persister.toColumns(fromElement.getTableAlias(), property)
: persister.toColumns(property);
String text = StringHelper.join(", ", columns);
setText(columns.length == 1 ? text : "(" + text + ")");
setType(SqlTokenTypes.SQL_TOKEN);
// these pieces are needed for usage in select clause
super.setDataType(propertyType);
nakedPropertyRef = true;
return PROPERTY_REF;
}
示例13: toString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return '(' + StringHelper.join( ' ' + op + ' ', criteria.iterator() ) + ')';
}
示例14: join
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private String join(String[] aliases) {
if ( aliases == null) return null;
return StringHelper.join( ", ", aliases );
}
示例15: createWhereByKey
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
protected String createWhereByKey(int tableNumber, String alias) {
//TODO: move to .sql package, and refactor with similar things!
return StringHelper.join( "=? and ",
StringHelper.qualify( alias, getSubclassTableKeyColumns( tableNumber ) ) ) + "=?";
}