Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DAO;
- import BD.*;
- import Bean.*;
- import java.sql.*;
- public class DAOEmploye {
- private SessionOracle s;
- private Statement stmt;
- public DAOEmploye(SessionOracle ss) throws SQLException
- {
- this.s = ss;
- this.stmt = s.getConnection().createStatement();
- }
- public void create(Employe e)
- {
- try {
- System.out.println("Création de l'employé dans la table ...");
- stmt.executeUpdate("INSERT INTO COPY_EMPLOYE VALUES(" + e.getNuempl() + ",'" + e.getNomempl() + "'," + e.getHebdo() + "," + e.getAffect() + "," + e.getSalaire() + ")");
- System.out.println("Insertion réussie !");
- } catch (SQLException e1) {
- System.out.println(e1);
- }
- }
- public void delete(Employe e)
- {
- try {
- System.out.println("Supression de la ligne de la table ...");
- stmt.executeUpdate("DELETE FROM COPY_EMPLOYE WHERE nuempl=" + e.getNuempl());
- System.out.println("Supression réussie !");
- } catch (SQLException e1) {
- System.out.println(e1);
- }
- }
- public void update(Employe e)
- {
- try {
- System.out.println("Update de la ligne de la table ...");
- stmt.executeUpdate("UPDATE COPY_EMPLOYE SET nuempl=" + e.getNuempl());
- System.out.println("Update réussie !");
- } catch (SQLException e1) {
- System.out.println(e1);
- }
- }
- public void read()
- {
- try {
- stmt.executeQuery("Select * from COPY_EMPLOYE order by 1");
- }
- catch (SQLException e) {
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement