本文整理汇总了Java中org.hibernate.dialect.Dialect.getDialect方法的典型用法代码示例。如果您正苦于以下问题:Java Dialect.getDialect方法的具体用法?Java Dialect.getDialect怎么用?Java Dialect.getDialect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.dialect.Dialect
的用法示例。
在下文中一共展示了Dialect.getDialect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SchemaExport
import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
/**
* Create a schema exporter for the given Configuration, with the given
* database connection properties.
*
* @param configuration The configuration from which to build a schema export.
* @param properties The properties from which to configure connectivity etc.
* @throws HibernateException Indicates problem preparing for schema export.
*
* @deprecated properties may be specified via the Configuration object
*/
@Deprecated
public SchemaExport(Configuration configuration, Properties properties) throws HibernateException {
final Dialect dialect = Dialect.getDialect( properties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( properties );
this.connectionHelper = new ManagedProviderConnectionHelper( props );
this.sqlStatementLogger = new SqlStatementLogger( false, true );
this.formatter = FormatStyle.DDL.getFormatter();
this.sqlExceptionHelper = new SqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
properties,
DEFAULT_IMPORT_FILE
);
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
示例2: executeScriptUrl
import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
private void executeScriptUrl(Configuration cfg, Connection connection, String scriptUrl) throws Exception
{
Dialect dialect = Dialect.getDialect(cfg.getProperties());
String dialectStr = dialect.getClass().getSimpleName();
InputStream scriptInputStream = getScriptInputStream(dialect.getClass(), scriptUrl);
// check that it exists
if (scriptInputStream == null)
{
throw AlfrescoRuntimeException.create(ERR_SCRIPT_NOT_FOUND, scriptUrl);
}
// write the script to a temp location for future and failure reference
File tempFile = null;
try
{
tempFile = TempFileProvider.createTempFile("AlfrescoSchema-" + dialectStr + "-Update-", ".sql");
ContentWriter writer = new FileContentWriter(tempFile);
writer.putContent(scriptInputStream);
}
finally
{
try { scriptInputStream.close(); } catch (Throwable e) {} // usually a duplicate close
}
// now execute it
String dialectScriptUrl = scriptUrl.replaceAll(PLACEHOLDER_DIALECT, dialect.getClass().getName());
// Replace the script placeholders
executeScriptFile(cfg, connection, tempFile, dialectScriptUrl);
}
示例3: SchemaUpdate
import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
public SchemaUpdate(Configuration configuration, Properties properties) throws HibernateException {
this.configuration = configuration;
this.dialect = Dialect.getDialect( properties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( properties );
this.connectionHelper = new ManagedProviderConnectionHelper( props );
this.sqlExceptionHelper = new SqlExceptionHelper();
this.sqlStatementLogger = new SqlStatementLogger( false, true );
this.formatter = FormatStyle.DDL.getFormatter();
}
示例4: SchemaValidator
import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
public SchemaValidator(Configuration cfg, Properties connectionProperties) throws HibernateException {
this.configuration = cfg;
dialect = Dialect.getDialect( connectionProperties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( connectionProperties );
connectionHelper = new ManagedProviderConnectionHelper( props );
}