mybatis的SqlSession.update不抛出SQLException异常吗
刚学习mybatis,照着sample写了代码,然后因为数据有锁,所以update的时候会抛异常。
可是捕获不到怎么办?代码如下:
try {
session.update(statement, newName);
} catch (SQLException e) {
System.out.println("an exception");
}
catch (SQLException e)的地方报错:
Unreachable catch block for SQLException. This exception is never thrown from the try statement body
就是说不可能抛出SQLException
那该怎么做错误处理?