001package edu.pdx.cs.joy.jdbc; 002 003import java.sql.SQLException; 004import java.util.List; 005 006/** 007 * Data Access Object interface for managing Department entities in the database. 008 */ 009public interface DepartmentDAO { 010 011 /** 012 * Saves a department to the database. 013 * The department's ID will be automatically generated by the database. 014 * 015 * @param department the department to save 016 * @throws SQLException if a database error occurs 017 */ 018 void save(Department department) throws SQLException; 019 020 /** 021 * Finds a department by its ID. 022 * 023 * @param id the ID to search for 024 * @return the department with the given ID, or null if not found 025 * @throws SQLException if a database error occurs 026 */ 027 Department findById(int id) throws SQLException; 028 029 /** 030 * Finds a department by its name. 031 * 032 * @param name the name to search for 033 * @return the department with the given name, or null if not found 034 * @throws SQLException if a database error occurs 035 */ 036 Department findByName(String name) throws SQLException; 037 038 /** 039 * Finds all departments in the database. 040 * 041 * @return a list of all departments 042 * @throws SQLException if a database error occurs 043 */ 044 List<Department> findAll() throws SQLException; 045 046 /** 047 * Updates an existing department in the database. 048 * 049 * @param department the department to update 050 * @throws SQLException if a database error occurs 051 */ 052 void update(Department department) throws SQLException; 053 054 /** 055 * Deletes a department from the database by ID. 056 * 057 * @param id the ID of the department to delete 058 * @throws SQLException if a database error occurs 059 */ 060 void delete(int id) throws SQLException; 061} 062