
[] 问答题
1.简述JDBC框架的主要组成部分。
[] 编程题
1.在SQL Server中创建数据库FH_ERP,并创建用户fherp,密码也是fherp,创建表如下:
ERP_EMPLOYEE
| 字段名 | 类型 | 说明 |
| EmployeeId | Varchar(20) | 员工帐号 |
| Password | Varchar(20) | 登录密码 |
| EmployeeName | Varchar(50) | 姓名 |
| Age | Int | 年龄 |
| Salary | Decimal | 工资 |
项目名:erp
根据公司域名和项目名确定各个层对象的包名.
3.编写数据库连接工厂类:ConnectionFactory, 有静态方法:
public static Connection getConnection() throws Exception
使用JNDI和数据库连接池取得连接并返回此连接。
4.编写员工值类:EmployeeValue, 封装员工表ERP_EMPLOYEE的各个字段。每个属性一对get/set方法。
5.编写员工DAO接口:IEmployeeDao, 有方法:
void create(EmployeeValue ev) throws Exception;//创建新员工
void update(EmployeeValue ev) throws Exception;//修改员工
void delete(EmployeeValue ev) throws Exception;//删除员工
EmployeeValue getEmployee(EmployeeValue ev) throws Exception;//取得指定的员工信息
List getAll() throws Exception;//取得所有员工列表
6.编写员工DAO接口实现类:EmployeeDaoImpl, 实现Dao接口IEmployeeDaode的所有方法.
7.编写DAO工厂类:DaoFactory,取得DAO接口的对象
8.编写员工业务接口:IEmployeeBusiness,有方法如下:
void add(String id,String password String name, int age, double salary) throws Exception;//
void modify(String id,String password String name, int age, double salary) throws Exception;//
void delete(String id) throws Exception;//
EmployeeValue get(String id) throws Exception;
List getAllList() throws Exception;
boolean isValite(String id,String password) throws Exception;
9.编写员工业务接口实现类:EmployeeBusinessImpl, 实现员工业务接口IEmployeeBusiness定义的方法.
10.编写业务工厂类:BusinessFactory, 有静态方法取得业务员工业务接口对象。
11.编写测试类Test.java,测试业务方法,完成员工的增加,修改,删除,查看,取得员工列表,验证员工是否合法。
