mybaties中的statement id硬编码

硬编码方式:

Apple apple = (Apple) session.selectOne("com.leesin.mapper.selectAppId", 1);

Mapper接口方式:

AppleMapper mapper = session.getMapper(AppleMapper.class);

硬编码方式的缺点:

  1. 无法进行类型检查,不知道方法存不存在
  2. 不知道有多少地方调用了它
  3. 修改麻烦
发布了531 篇原创文章 · 获赞 2927 · 访问量 246万+

猜你喜欢

转载自blog.csdn.net/dataiyangu/article/details/104758807