MyBatis中的注解
生活随笔
收集整理的這篇文章主要介紹了
MyBatis中的注解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼實現
1. @Select("select * from student") 2. List<Student> selectAll(); 3. 4. @Select("select * from student where sid=#{param1}") 5. Student selectOne(int id); 6. 7. @Insert("insert into student values(default,#{sname},#{clazzno})") 8. int insert(Student student); 9. 10. @Update("update student set sname=#{sname} where sid=#{sid}") 11. int update(Student student); 12. 13. @Delete("delete from student where sid=#{param1}") 14. int delte(int sid);02注解使用的優缺點
[1] 使用注解沒有實現java代碼個sql語句的解耦
[2] 進行多表的查詢比較的麻煩
[3] 無法實現sql語句的動態拼接
總結
以上是生活随笔為你收集整理的MyBatis中的注解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MyBatis中ThreadLocal
- 下一篇: MyBatis中的原理