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


Java Dialect.appendLockHint方法代码示例

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


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

示例1: TableStructure

import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
public TableStructure(
		Dialect dialect,
		String tableName,
		String valueColumnName,
		int initialValue,
		int incrementSize,
		Class numberType) {
	this.tableName = tableName;
	this.initialValue = initialValue;
	this.incrementSize = incrementSize;
	this.valueColumnName = valueColumnName;
	this.numberType = numberType;

	selectQuery = "select " + valueColumnName + " as id_val" +
			" from " + dialect.appendLockHint( LockMode.PESSIMISTIC_WRITE, tableName ) +
			dialect.getForUpdateString();

	updateQuery = "update " + tableName +
			" set " + valueColumnName + "= ?" +
			" where " + valueColumnName + "=?";
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:TableStructure.java

示例2: 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

示例3: 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


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