使用MyBatis实现增删改查
mybatis学习笔记(二)

parameterType参数在mybatis-config.xml中设置别名后,就不需要再写完全限定名,直接写别名就行
mybatis学习笔记(二)
mybatis学习笔记(二)

  • 测试类
    mybatis学习笔记(二)
  • 这样就在数据库中插入一条数据
    mybatis学习笔记(二)
  • 频繁的创建sqlSessionFactory不太好,我们优化一下,创建一个工具类做成一个单例模式
    mybatis学习笔记(二)
  • 接着我们修改下测试类:
    mybatis学习笔记(二)
  • 给每个类起别名,太麻烦了,mybatis提供了针对包名下所有的类同时起别名的方法,别名就是类名本身
    mybatis学习笔记(二)




相关文章:

  • 2021-10-27
  • 2021-11-08
  • 2021-12-30
  • 2022-12-23
  • 2021-04-15
  • 2021-12-19
  • 2021-06-02
猜你喜欢
  • 2021-09-23
  • 2021-06-27
  • 2022-01-05
  • 2022-12-23
  • 2021-09-14
  • 2021-06-18
  • 2021-05-17
相关资源
相似解决方案