public class MyBatisExceptionTranslator extends Object implements org.springframework.dao.support.PersistenceExceptionTranslator
DataAccessException
using Spring's SQLExceptionTranslator
Can load SQLExceptionTranslator
eagerly or when the
first exception is translated.Constructor and Description |
---|
MyBatisExceptionTranslator(DataSource dataSource,
boolean exceptionTranslatorLazyInit)
Creates a new
DataAccessExceptionTranslator instance. |
Modifier and Type | Method and Description |
---|---|
org.springframework.dao.DataAccessException |
translateExceptionIfPossible(RuntimeException e) |
public MyBatisExceptionTranslator(DataSource dataSource, boolean exceptionTranslatorLazyInit)
DataAccessExceptionTranslator
instance.dataSource
- DataSource to use to find metadata and establish which error codes are usable.exceptionTranslatorLazyInit
- if true, the translator instantiates internal stuff only the first time will
have the need to translate exceptions.public org.springframework.dao.DataAccessException translateExceptionIfPossible(RuntimeException e)
translateExceptionIfPossible
in interface org.springframework.dao.support.PersistenceExceptionTranslator
Copyright © 2010–2019 MyBatis.org. All rights reserved.