當前位置: 首頁>>代碼示例>>Java>>正文


Java Dialect.quote方法代碼示例

本文整理匯總了Java中org.hibernate.dialect.Dialect.quote方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialect.quote方法的具體用法?Java Dialect.quote怎麽用?Java Dialect.quote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.dialect.Dialect的用法示例。


在下文中一共展示了Dialect.quote方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configure

import org.hibernate.dialect.Dialect; //導入方法依賴的package包/類
public void configure(Type type, Properties params, Dialect dialect) {
	identifierType = type;

	ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );

	tableName = ConfigurationHelper.getString( TABLE, params, DEFAULT_TABLE_NAME );
	if ( tableName.indexOf( '.' ) < 0 ) {
		final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
		final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
		tableName = Table.qualify(
				dialect.quote( catalogName ),
				dialect.quote( schemaName ),
				dialect.quote( tableName )
		);
	}
	else {
		// if already qualified there is not much we can do in a portable manner so we pass it
		// through and assume the user has set up the name correctly.
	}

	columnName = dialect.quote(
			normalizer.normalizeIdentifierQuoting(
					ConfigurationHelper.getString( COLUMN, params, DEFAULT_COLUMN_NAME )
			)
	);

	query = "select " +
		columnName +
		" from " +
		dialect.appendLockHint(LockMode.PESSIMISTIC_WRITE, tableName) +
		dialect.getForUpdateString();

	update = "update " +
		tableName +
		" set " +
		columnName +
		" = ? where " +
		columnName +
		" = ?";
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:41,代碼來源:TableGenerator.java

示例2: configure

import org.hibernate.dialect.Dialect; //導入方法依賴的package包/類
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );

	tableName = normalizer.normalizeIdentifierQuoting( ConfigurationHelper.getString( ID_TABLE, params, DEFAULT_TABLE ) );
	if ( tableName.indexOf( '.' ) < 0 ) {
		tableName = dialect.quote( tableName );
		final String schemaName = dialect.quote(
				normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) )
		);
		final String catalogName = dialect.quote(
				normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) )
		);
		tableName = Table.qualify( catalogName, schemaName, tableName );
	}
	else {
		// if already qualified there is not much we can do in a portable manner so we pass it
		// through and assume the user has set up the name correctly.
	}

	pkColumnName = dialect.quote(
			normalizer.normalizeIdentifierQuoting(
					ConfigurationHelper.getString( PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN )
			)
	);
	valueColumnName = dialect.quote(
			normalizer.normalizeIdentifierQuoting(
					ConfigurationHelper.getString( VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN )
			)
	);
	keySize = ConfigurationHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH);
	String keyValue = ConfigurationHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) );

	query = "select " +
		valueColumnName +
		" from " +
		dialect.appendLockHint( LockMode.PESSIMISTIC_WRITE, tableName ) +
		" where " + pkColumnName + " = '" + keyValue + "'" +
		dialect.getForUpdateString();

	update = "update " +
		tableName +
		" set " +
		valueColumnName +
		" = ? where " +
		valueColumnName +
		" = ? and " +
		pkColumnName +
		" = '" +
		keyValue
		+ "'";

	insert = "insert into " + tableName +
		"(" + pkColumnName + ", " +	valueColumnName + ") " +
		"values('"+ keyValue +"', ?)";


	//hilo config
	maxLo = ConfigurationHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
	returnClass = type.getReturnedClass();

	if ( maxLo >= 1 ) {
		hiloOptimizer = new LegacyHiLoAlgorithmOptimizer( returnClass, maxLo );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:65,代碼來源:MultipleHiLoPerTableGenerator.java

示例3: configure

import org.hibernate.dialect.Dialect; //導入方法依賴的package包/類
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	returnClass = type.getReturnedClass();

	ObjectNameNormalizer normalizer =
			( ObjectNameNormalizer ) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER );

	String column = params.getProperty( "column" );
	if ( column == null ) {
		column = params.getProperty( PersistentIdentifierGenerator.PK );
	}
	column = dialect.quote( normalizer.normalizeIdentifierQuoting( column ) );

	String tableList = params.getProperty( "tables" );
	if ( tableList == null ) {
		tableList = params.getProperty( PersistentIdentifierGenerator.TABLES );
	}
	String[] tables = StringHelper.split( ", ", tableList );

	final String schema = dialect.quote(
			normalizer.normalizeIdentifierQuoting(
					params.getProperty( PersistentIdentifierGenerator.SCHEMA )
			)
	);
	final String catalog = dialect.quote(
			normalizer.normalizeIdentifierQuoting(
					params.getProperty( PersistentIdentifierGenerator.CATALOG )
			)
	);

	StringBuilder buf = new StringBuilder();
	for ( int i=0; i < tables.length; i++ ) {
		final String tableName = dialect.quote( normalizer.normalizeIdentifierQuoting( tables[i] ) );
		if ( tables.length > 1 ) {
			buf.append( "select max(" ).append( column ).append( ") as mx from " );
		}
		buf.append( Table.qualify( catalog, schema, tableName ) );
		if ( i < tables.length-1 ) {
			buf.append( " union " );
		}
	}
	if ( tables.length > 1 ) {
		buf.insert( 0, "( " ).append( " ) ids_" );
		column = "ids_.mx";
	}

	sql = "select max(" + column + ") from " + buf.toString();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:48,代碼來源:IncrementGenerator.java

示例4: determineValueColumnName

import org.hibernate.dialect.Dialect; //導入方法依賴的package包/類
/**
 * Determine the name of the column used to store the generator value in
 * the db.
 * <p/>
 * Called during {@link #configure configuration} <b>when resolving to a
 * physical table</b>.
 *
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param dialect The dialect in effect.
 * @return The value column name
 */
protected String determineValueColumnName(Properties params, Dialect dialect) {
	final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
	final String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
	return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:SequenceStyleGenerator.java

示例5: determineSegmentColumnName

import org.hibernate.dialect.Dialect; //導入方法依賴的package包/類
/**
 * Determine the name of the column used to indicate the segment for each
 * row.  This column acts as the primary key.
 * <p/>
 * Called during {@link #configure configuration}.
 *
 * @see #getSegmentColumnName()
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param dialect The dialect in effect
 * @return The name of the segment column
 */
protected String determineSegmentColumnName(Properties params, Dialect dialect) {
	final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
	final String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN );
	return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:TableGenerator.java

示例6: determineValueColumnName

import org.hibernate.dialect.Dialect; //導入方法依賴的package包/類
/**
 * Determine the name of the column in which we will store the generator persistent value.
 * <p/>
 * Called during {@link #configure configuration}.
 *
 * @see #getValueColumnName()
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param dialect The dialect in effect
 * @return The name of the value column
 */
protected String determineValueColumnName(Properties params, Dialect dialect) {
	final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER );
	final String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN );
	return dialect.quote( normalizer.normalizeIdentifierQuoting( name ) );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:TableGenerator.java


注:本文中的org.hibernate.dialect.Dialect.quote方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。