本文整理汇总了Java中org.hibernate.dialect.Dialect.buildSQLExceptionConverter方法的典型用法代码示例。如果您正苦于以下问题:Java Dialect.buildSQLExceptionConverter方法的具体用法?Java Dialect.buildSQLExceptionConverter怎么用?Java Dialect.buildSQLExceptionConverter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.dialect.Dialect
的用法示例。
在下文中一共展示了Dialect.buildSQLExceptionConverter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSQLExceptionConverter
import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
/**
* Build a SQLExceptionConverter instance.
* <p/>
* First, looks for a {@link Environment#SQL_EXCEPTION_CONVERTER} property to see
* if the configuration specified the class of a specific converter to use. If this
* property is set, attempt to construct an instance of that class. If not set, or
* if construction fails, the converter specific to the dialect will be used.
*
* @param dialect The defined dialect.
* @param properties The configuration properties.
* @return An appropriate SQLExceptionConverter instance.
* @throws HibernateException There was an error building the SQLExceptionConverter.
*/
public static SQLExceptionConverter buildSQLExceptionConverter(Dialect dialect, Properties properties) throws HibernateException {
SQLExceptionConverter converter = null;
String converterClassName = (String) properties.get( Environment.SQL_EXCEPTION_CONVERTER );
if ( StringHelper.isNotEmpty( converterClassName ) ) {
converter = constructConverter( converterClassName, dialect.getViolatedConstraintNameExtracter() );
}
if ( converter == null ) {
LOG.trace( "Using dialect defined converter" );
converter = dialect.buildSQLExceptionConverter();
}
if ( converter instanceof Configurable ) {
try {
( (Configurable) converter ).configure( properties );
}
catch (HibernateException e) {
LOG.unableToConfigureSqlExceptionConverter( e );
throw e;
}
}
return converter;
}
示例2: DatabaseMetadata
import org.hibernate.dialect.Dialect; //导入方法依赖的package包/类
public DatabaseMetadata(Connection connection, Dialect dialect, Configuration config, boolean extras)
throws SQLException {
sqlExceptionConverter = dialect.buildSQLExceptionConverter();
meta = connection.getMetaData();
this.extras = extras;
initSequences( connection, dialect );
if ( config != null
&& ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, config.getProperties(), false ) ) {
types = new String[] { "TABLE", "VIEW", "SYNONYM" };
}
else {
types = new String[] { "TABLE", "VIEW" };
}
}