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


Java Dialect.supportsSequences方法代码示例

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


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

示例1: initSequences

import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
private void initSequences(Connection connection, Dialect dialect) throws SQLException {
	if ( dialect.supportsSequences() ) {
		String sql = dialect.getQuerySequencesString();
		if (sql!=null) {

			Statement statement = null;
			ResultSet rs = null;
			try {
				statement = connection.createStatement();
				rs = statement.executeQuery(sql);

				while ( rs.next() ) {
					sequences.add( StringHelper.toLowerCase(rs.getString(1)).trim() );
				}
			}
			finally {
				if ( rs != null ) {
					rs.close();
				}
				if ( statement != null ) {
					statement.close();
				}
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:DatabaseMetadata.java

示例2: buildDatabaseStructure

import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
/**
 * Build the database structure.
 *
 * @param type The Hibernate type of the identifier property
 * @param params The params supplied in the generator config (plus some standard useful extras).
 * @param dialect The dialect being used.
 * @param forceTableUse Should a table be used even if the dialect supports sequences?
 * @param sequenceName The name to use for the sequence or table.
 * @param initialValue The initial value.
 * @param incrementSize the increment size to use (after any adjustments).
 *
 * @return An abstraction for the actual database structure in use (table vs. sequence).
 */
protected DatabaseStructure buildDatabaseStructure(
		Type type,
		Properties params,
		Dialect dialect,
		boolean forceTableUse,
		String sequenceName,
		int initialValue,
		int incrementSize) {
	final boolean useSequence = dialect.supportsSequences() && !forceTableUse;
	if ( useSequence ) {
		return new SequenceStructure( dialect, sequenceName, initialValue, incrementSize, type.getReturnedClass() );
	}
	else {
		final String valueColumnName = determineValueColumnName( params, dialect );
		return new TableStructure( dialect, sequenceName, valueColumnName, initialValue, incrementSize, type.getReturnedClass() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:SequenceStyleGenerator.java

示例3: configure

import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
@Override
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
	this.identifierType = type;
	boolean forceTableUse = ConfigurationHelper.getBoolean( FORCE_TBL_PARAM, params, false );

	final String sequenceName = determineSequenceName( params, dialect );

	final int initialValue = determineInitialValue( params );
	int incrementSize = determineIncrementSize( params );

	final String optimizationStrategy = determineOptimizationStrategy( params, incrementSize );
	incrementSize = determineAdjustedIncrementSize( optimizationStrategy, incrementSize );

	if ( dialect.supportsSequences() && !forceTableUse ) {
		if ( !dialect.supportsPooledSequences() && OptimizerFactory.isPooledOptimizer( optimizationStrategy ) ) {
			forceTableUse = true;
			LOG.forcingTableUse();
		}
	}

	this.databaseStructure = buildDatabaseStructure(
			type,
			params,
			dialect,
			forceTableUse,
			sequenceName,
			initialValue,
			incrementSize
	);
	this.optimizer = OptimizerFactory.buildOptimizer(
			optimizationStrategy,
			identifierType.getReturnedClass(),
			incrementSize,
			ConfigurationHelper.getInt( INITIAL_PARAM, params, -1 )
	);
	this.databaseStructure.prepare( optimizer );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:SequenceStyleGenerator.java


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