public class empservice { private final String ADD= "inster into emp(id,ename)values (null,?)"; private final String EDIT= "update emp set ename = ? where id =?"; private final String DELETE= "delete from emp where id =?"; private final String LEST= "select * from emp"; public void add (emp entity){
Connection coon = DBUtil.getConnection(); try {
PreparedStatement patmt = coon.prepareStatement(ADD);
patmt.setString(1,entity.getName());
patmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
DBUtil.close(coon);
}
}
}
private int id; private String name; private String gender; private double salary; private Date join_date; private int dept_id;
public int getId() { return id;
}
public void setId(int id) { this.id = id;
}
public String getName() { return name;
}
public void setName(String name) { this.name = name;
}
public String getGender() { return gender;
}
public void setGender(String gender) { this.gender = gender;
}
public double getSalary() { return salary;
}
public void setSalary(double salary) { this.salary = salary;
}
public Date getJoin_date() { return join_date;
}
public void setJoin_date(Date join_date) { this.join_date = join_date;
}
public int getDept_id() { return dept_id;
}
public void setDept_id(int dept_id) { this.dept_id = dept_id;
}