001package edu.pdx.cs.joy.jdbc;
002
003import java.sql.SQLException;
004import java.util.List;
005
006/**
007 * Data Access Object interface for managing Course entities in the database.
008 */
009public interface CourseDAO {
010
011  /**
012   * Saves a course to the database.
013   * The course's ID will be automatically generated by the database and set on the object.
014   *
015   * @param course the course to save
016   * @throws SQLException if a database error occurs
017   */
018  void save(Course course) throws SQLException;
019
020  /**
021   * Finds a course by its title.
022   *
023   * @param title the title to search for
024   * @return the course with the given title, or null if not found
025   * @throws SQLException if a database error occurs
026   */
027  Course findByTitle(String title) throws SQLException;
028
029  /**
030   * Finds all courses associated with a specific department.
031   *
032   * @param departmentId the department ID to search for
033   * @return a list of courses in the department
034   * @throws SQLException if a database error occurs
035   */
036  List<Course> findByDepartmentId(int departmentId) throws SQLException;
037
038  /**
039   * Updates an existing course in the database.
040   * Uses the course's ID to identify which record to update.
041   *
042   * @param course the course to update
043   * @throws SQLException if a database error occurs
044   */
045  void update(Course course) throws SQLException;
046}
047