本文整理匯總了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();
}
}
}
}
}
示例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() );
}
}
示例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 );
}