MyBatis 快速實戰入門

Mapper方式

步驟指南

  1. 引入依賴
  2. mybatis 配置文件:mybatis-config.xml
  3. mapper.xml:類比於dao接口
  4. 構建sqlSessionFactory,打開會話,執行,close;

https://blog.csdn.net/hellozpc/article/details/80878563

源碼

demo源碼,可以在此基礎上修改,構建項目
mybatis demo源碼

註解方式

理論上不需要mapper,mybatis-config.xml,只需要在dao中的方法上加註解寫sql即可;

https://blog.csdn.net/xuyuzhuang1991/article/details/54143945
https://www.cnblogs.com/zwwhnly/p/11136448.html

PS:可以通過mybatis-config.xml 加配置,如駝峯匹配;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章