Package edu.pdx.cs.joy.jdbc
Interface CourseDAO
- All Known Implementing Classes:
CourseDAOImpl
public interface CourseDAO
Data Access Object interface for managing Course entities in the database.
-
Method Summary
Modifier and TypeMethodDescriptionfindByDepartmentId(int departmentId) Finds all courses associated with a specific department.findByTitle(String title) Finds a course by its title.voidSaves a course to the database.voidUpdates an existing course in the database.
-
Method Details
-
save
Saves a course to the database. The course's ID will be automatically generated by the database and set on the object.- Parameters:
course- the course to save- Throws:
SQLException- if a database error occurs
-
findByTitle
Finds a course by its title.- Parameters:
title- the title to search for- Returns:
- the course with the given title, or null if not found
- Throws:
SQLException- if a database error occurs
-
findByDepartmentId
Finds all courses associated with a specific department.- Parameters:
departmentId- the department ID to search for- Returns:
- a list of courses in the department
- Throws:
SQLException- if a database error occurs
-
update
Updates an existing course in the database. Uses the course's ID to identify which record to update.- Parameters:
course- the course to update- Throws:
SQLException- if a database error occurs
-