马上快过年了,今年的年过的很不一样,新冠也不知道啥时候可以彻底消灭。
财务不自由的我。决定留在大上海,过年如果没事干就写写文章。欧耶~
活着就去做想做的事!不推迟不放弃。
进入主题
一:目录总览
异常模块的东西看着是不多哈。相比之前的反射模块,这个看起来真的比较轻松。
实际上,mybatis的异常类并非全部定义在这个目录下。其他的包下也是有的。下面整理罗列了下
这些异常类代码都是相同的。所以,这里就简单整理如下:
reflection
包:ReflectionExceptionlogging
包:LogExceptionbuilder
包:BuilderException、IncompleteElementExceptionscripting
包:ScriptingExceptionbinding
包:BindingExceptiontype
包:TypeExceptionsession
包:SqlSessionExceptioncache
包:CacheExceptiontransaction
包:TransactionExceptiondatasource
包:DataSourceExceptionexecutor
包:ResultMapException、ExecutorException、BatchExecutorExceptionplugin
包:PluginException
二: IbatisException 类继承 RuntimeException,IBatis 的异常基类,具体代码如下。
package org.apache.ibatis.exceptions;
/**
* @author Clinton Begin
*/
@Deprecated
public class IbatisException extends RuntimeException {
private static final long serialVersionUID = 3880206998166270511L;
public IbatisException() {
super();
}
public IbatisException(String message) {
super(message);
}
public IbatisException(String message, Throwable cause) {
super(message, cause);
}
public IbatisException(Throwable cause) {
super(cause);
}
}
三: PersistenceException,继承 IbatisException 类,目前 MyBatis 真正的异常基类。代码如下: