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>

 

相关文章:

  • 2021-07-25
  • 2021-12-22
  • 2021-05-14
  • 2022-12-23
  • 2021-08-09
  • 2021-05-18
猜你喜欢
  • 2021-04-29
  • 2021-10-06
  • 2022-01-08
  • 2021-10-16
  • 2022-01-23
  • 2021-08-03
  • 2021-05-21
相关资源
相似解决方案