吾欲乘风归去,又恐琼楼玉宇 2022-06-12 08:48 采纳率: 0%
浏览 195

运行后SQL,MyBatis就会卡住不动

遇到一个很奇怪的问题,MyBatis使用对象传参,感觉写的没问题,但是运行后,MyBatis就会卡住不动
servlet层

        if("selectByNameByEmailByAge".equals(re)){
            Student stu = new StudentServiceImpl().selectByNameByEmailByAge(new Student(request.getParameter("name"),request.getParameter("email"),Integer.parseInt(request.getParameter("age"))));
            text = stu != null ? stu.toString() : "没有查询到哦!";
            System.out.println(text);
        }

dao层

   Student selectByNameByEmailByAge(Student stu);

Mapper文件

    <select id="selectByNameByEmailByAge" resultType="Student">
        select *
        from student
        where name = #{name} and email = #{email} and age = #{age}
    </select>

实体类

public class Student {
    private int id;
    private String name;
    private String email;
    private int age;

    public Student(int id, String name, String email, int age) {
        this.id = id;
        this.name = name;
        this.email = email;
        this.age = age;
    }

    public Student(String name, String email, int age) {
        this.id = id;
        this.name = name;
        this.email = email;
        this.age = age;
    }
实体类中省略getset方法

我反复阅读都没问题,但是就是会卡住,我也尝试过在Mapper写其他的,比如加上参数类型什么的,但是都没用,直到我又删了重新写了一遍,居然就好了!很奇怪!

  • 写回答

1条回答 默认 最新

  • 卡布奇诺-海晨 Java领域优质创作者 2022-06-12 09:56
    关注

    好了不就行了吗,不用太纠结了

    评论

报告相同问题?

问题事件

  • 修改了问题 6月12日
  • 修改了问题 6月12日
  • 创建了问题 6月12日

悬赏问题

  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Bug traq 数据包 大概什么价
  • ¥15 在anaconda上pytorch和paddle paddle下载报错
  • ¥25 自动填写QQ腾讯文档收集表