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