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

XML配置文件

时间:2019-11-21 22:49:17      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:play   img   cto   one   sql   code   lse   void   commit   

技术图片
 1 public class StudentDAOImpl implements IStudentDAO {
 2 
 3     @Override
 4     public void save(Student stu) {
 5         SqlSession session = MybatisUtil.getSession();
 6         session.insert("cn.woldcode.smis.mapper.StudentMapper.save",stu);
 7         session.commit();
 8         session.close();
 9     }
10 
11     @Override
12     public void delete(Long id) {
13         SqlSession session = MybatisUtil.getSession();
14         session.delete("cn.woldcode.smis.mapper.StudentMapper.delete",id);
15         session.commit();
16         session.close();
17     }
18 
19     @Override
20     public void update(Student stu) {
21         SqlSession session = MybatisUtil.getSession();
22         session.update("cn.woldcode.smis.mapper.StudentMapper.update",stu);
23         session.commit();
24         session.close();
25     }
26 
27     @Override
28     public Student get(Long id) {
29         SqlSession session = MybatisUtil.getSession();
30         Student stu = session.selectOne("cn.woldcode.smis.mapper.StudentMapper.get",id);
31         session.close();
32         return stu;
33     }
34 
35     @Override
36     public List<Student> listAll() {
37         SqlSession session = MybatisUtil.getSession();
38         List<Student> list = session.selectList("cn.woldcode.smis.mapper.StudentMapper.listAll");
39         session.close();
40         return list;
41     }
42     
43 
44 }
View Code

 

 

 

XML配置文件

标签:play   img   cto   one   sql   code   lse   void   commit   

原文地址:https://www.cnblogs.com/ranxiaofan/p/11908788.html

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