Interface DepartmentDAO

All Known Implementing Classes:
DepartmentDAOImpl

public interface DepartmentDAO
Data Access Object interface for managing Department entities in the database.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(int id)
    Deletes a department from the database by ID.
    Finds all departments in the database.
    findById(int id)
    Finds a department by its ID.
    Finds a department by its name.
    void
    save(Department department)
    Saves a department to the database.
    void
    update(Department department)
    Updates an existing department in the database.
  • Method Details

    • save

      void save(Department department) throws SQLException
      Saves a department to the database. The department's ID will be automatically generated by the database.
      Parameters:
      department - the department to save
      Throws:
      SQLException - if a database error occurs
    • findById

      Finds a department by its ID.
      Parameters:
      id - the ID to search for
      Returns:
      the department with the given ID, or null if not found
      Throws:
      SQLException - if a database error occurs
    • findByName

      Finds a department by its name.
      Parameters:
      name - the name to search for
      Returns:
      the department with the given name, or null if not found
      Throws:
      SQLException - if a database error occurs
    • findAll

      Finds all departments in the database.
      Returns:
      a list of all departments
      Throws:
      SQLException - if a database error occurs
    • update

      void update(Department department) throws SQLException
      Updates an existing department in the database.
      Parameters:
      department - the department to update
      Throws:
      SQLException - if a database error occurs
    • delete

      void delete(int id) throws SQLException
      Deletes a department from the database by ID.
      Parameters:
      id - the ID of the department to delete
      Throws:
      SQLException - if a database error occurs