关于mybatis查询出错,异常情况下返回值的问题
2018-03-01 16:01
555 查看
public class MybatisExceptionTest { public static void main(String[] args) { try { System.out.println(testListReturn()); } catch (Exception e) { e.printStackTrace(); System.out.println("此处是dao层异常,自己需要判断return的值"); } } private static List<String> testListReturn() throws Exception { List<String> list; try { List re = test(); list = re; } catch (Exception ex) { throw new Exception(ex); } return list;//此处是sqlSession中selectList的返回 } private static List<String> test() throws Exception { int i = 0; if (i != 1) { throw new Exception("test mybatis exception"); } return new ArrayList<>(); } }
相关文章推荐
- 关于mybatis中collection一对多关联查询分页出错问题总结
- 关于mybatis中collection一对多关联查询分页出错问题总结
- Mybatis全部查询遇到的返回类型的小问题
- mybatis查询类型为int的字段,返回null的异常
- 关于Mybatis查询时间问题的考虑
- 关于SQL语言,查询关联多张表出现的,无法返回空值的问题。
- mybatis查询类型为int的字段,返回null的异常
- 关于mybatis 中文条件查询没结果的问题
- 关于tomcat的种种问题,异常,出错
- 关于mybatis 使用case when 计算BigDecimal 数据返回对象的问题
- 在使用mybatis时遇到查询结果返回为空的情况,但是查数据库能查到
- 关于mybatis 中文条件查询没结果的问题
- 关于hibernate的查询返回类型问题总结
- Mybatis 查询int类型数据,返回记录条数为0时报错问题解决
- 解决mybatis使用char类型字段查询oracle数据库时结果返回null问题
- 关于mybatis查询返回null
- mybatis查询,如果返回类型为resultType时,查询不到某些属性值问题
- 关于mybatis只能查询英文,不能查询中文的问题!!!
- 关于myBatis与SQLserver 配合使用,查询类型为Date的数据时,日期会减少两天的问题
- 关于Mybatis一次性插入多条数据返回的记录数的问题