19计应3班赖晓桐
- 上次课完成了实体类:College、Student、Status、User
接口类:CollegeDao、StudentDao、StatusDao、UserDao - 并且对user做了一些简单的增删改查以及登录的操作,这次课的任务是创建数据访问接口实现类。
- 首先创建CollegeDaoImpl、StudentDaoImpl、StatusDaoImpl、UserDaoImpl类继承自CollegeDao、StudentDao、StatusDao、UserDao接口并继承改写其中的方法。
- 然后再创建testCollegeDaoImpl、testStudentDaoImpl、testStatusDaoImpl、testUserDaoImpl类l来实现CollegeDaoImpl、StudentDaoImpl、StatusDaoImpl、UserDaoImpl类中的方法:(举例)
在test中测试实现Impl方法中的功能,代码很多,但各个方法之间大同小异,照着老师的代码敲几个,自己背着敲几个,可以提升自己对代码的熟悉程度以及对代码的理解程度。遇到错误是必不可免的,找出它,改正它。
- 错误1:
能插入成功,但是运行完会报错,回到UserDaoImpl中检查代码,发现结果集的关闭与