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


Java Dialect.buildSQLExceptionConverter方法代码示例

本文整理汇总了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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:SQLExceptionConverterFactory.java

示例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" };
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:DatabaseMetadata.java


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