求一个旅游网站的代码,有哪些好的做网站公司好,杭州外贸网站建设公司,互联国际网站首先创建一个对象
将这个对象使用mybatis插入数据库
Student stu new Student(null, stu, 18, null);
mapper.insertEntity(stu);
System.out.println(stu);
在mapper.xml文件中开启配置之后输出传入的stu对象就会有主键id回传
!-- 插入语句示例 int ins…首先创建一个对象
将这个对象使用mybatis插入数据库
Student stu new Student(null, stu, 18, null);
mapper.insertEntity(stu);
System.out.println(stu);
在mapper.xml文件中开启配置之后输出传入的stu对象就会有主键id回传
!-- 插入语句示例 int insertEntity(Student student);useGeneratedKeystrue 表示当前标签中要执行的sql使用了自动递增主键keyPropertystudentId 表示把自动递增的主键的值 放入 方法中传输过来参数中的某一个属性中 (放入了student studentId属性中)
--
insert idinsertEntity useGeneratedKeystrue keyPropertystudentIdinsert into student(student_id,student_name,student_age,student_image)values (#{studentId},#{studentName},#{studentAge},#{studentImage});
/insert