接口的使用
org.springframework.jdbc.support.SQLExceptionTranslator
使用SQLExceptionTranslator的程序包 程序包 说明 org.springframework.jdbc.core.support Classes supporting theorg.springframework.jdbc.corepackage.org.springframework.jdbc.support Support classes for the JDBC framework, used by the classes in the jdbc.core and jdbc.object packages.org.springframework.orm.hibernate5 Package providing integration of Hibernate 5.x with Spring concepts.org.springframework.orm.jpa.vendor Support classes for adapting to specific JPA vendors.org.springframework.jdbc.core.support中SQLExceptionTranslator的使用
返回SQLExceptionTranslator的org.springframework.jdbc.core.support中的方法 修饰符和类型 方法 说明 protected SQLExceptionTranslatorJdbcDaoSupport. getExceptionTranslator()Return the SQLExceptionTranslator of this DAO's JdbcTemplate, for translating SQLExceptions in custom JDBC access code.org.springframework.jdbc.support中SQLExceptionTranslator的使用
实现SQLExceptionTranslator的org.springframework.jdbc.support中的类 修饰符和类型 类 说明 classAbstractFallbackSQLExceptionTranslatorBase class forSQLExceptionTranslatorimplementations that allow for fallback to some otherSQLExceptionTranslator.classSQLErrorCodeSQLExceptionTranslatorImplementation ofSQLExceptionTranslatorthat analyzes vendor-specific error codes.classSQLExceptionSubclassTranslatorSQLExceptionTranslatorimplementation which analyzes the specificSQLExceptionsubclass thrown by the JDBC driver.classSQLStateSQLExceptionTranslatorSQLExceptionTranslatorimplementation that analyzes the SQL state in theSQLExceptionbased on the first two digits (the SQL state "class").返回SQLExceptionTranslator的org.springframework.jdbc.support中的方法 修饰符和类型 方法 说明 SQLExceptionTranslatorCustomSQLExceptionTranslatorRegistry. findTranslatorForDatabase(String dbName)Find a custom translator for the specified database.SQLExceptionTranslatorSQLErrorCodes. getCustomSqlExceptionTranslator()SQLExceptionTranslatorJdbcAccessor. getExceptionTranslator()Return the exception translator for this instance.SQLExceptionTranslatorAbstractFallbackSQLExceptionTranslator. getFallbackTranslator()Return the fallback exception translator, if any.参数类型为SQLExceptionTranslator的org.springframework.jdbc.support中的方法 修饰符和类型 方法 说明 voidCustomSQLExceptionTranslatorRegistry. registerTranslator(String dbName, SQLExceptionTranslator translator)Register a new custom translator for the specified database name.voidSQLErrorCodes. setCustomSqlExceptionTranslator(SQLExceptionTranslator customSqlExceptionTranslator)voidJdbcAccessor. setExceptionTranslator(SQLExceptionTranslator exceptionTranslator)Set the exception translator for this instance.voidAbstractFallbackSQLExceptionTranslator. setFallbackTranslator(SQLExceptionTranslator fallback)Override the default SQL state fallback translator (typically aSQLStateSQLExceptionTranslator).类型变量类型为SQLExceptionTranslator的org.springframework.jdbc.support中的方法参数 修饰符和类型 方法 说明 voidSQLErrorCodes. setCustomSqlExceptionTranslatorClass(Class<? extends SQLExceptionTranslator> customTranslatorClass)voidCustomSQLExceptionTranslatorRegistrar. setTranslators(Map<String,SQLExceptionTranslator> translators)Setter for a Map ofSQLExceptionTranslatorreferences where the key must be the database name as defined in thesql-error-codes.xmlfile.org.springframework.orm.hibernate5中SQLExceptionTranslator的使用
参数类型为SQLExceptionTranslator的org.springframework.orm.hibernate5中的方法 修饰符和类型 方法 说明 voidHibernateExceptionTranslator. setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)Set the JDBC exception translator for Hibernate exception translation purposes.org.springframework.orm.jpa.vendor中SQLExceptionTranslator的使用
参数类型为SQLExceptionTranslator的org.springframework.orm.jpa.vendor中的方法 修饰符和类型 方法 说明 voidHibernateJpaDialect. setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)Set the JDBC exception translator for Hibernate exception translation purposes.