码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis的动态代理模式

时间:2017-09-04 21:22:28      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:names   where   from   规则   接口   sid   col   cts   res   

mybatis的动态代理需要遵循4个规则:

  1.xml文件中的namespace的值为接口类的全限命名

  2.statement的id要跟接口的方法名相同。

  3.statement的parameterType要跟接口的方法的参数的类型相同。

  4.statement的resultType要跟接口方法的返回值类型相同。

 

接口:

  

    public Student selectStuById(int id);

xml文件:

<select id="selectStuById" resultType="com.neuedu.bean.Student"  parameterType="Integer">
        select * from stu1 where sid = #{sid}
    </select>

 

Mybatis的动态代理模式

标签:names   where   from   规则   接口   sid   col   cts   res   

原文地址:http://www.cnblogs.com/xuesheng/p/7475693.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!