Interface IUserDAO
- All Known Implementing Classes:
UserDAO
public interface IUserDAO
Defines the interface for a User DAO.
Any class implementing
IUserDAO
must provide implementations for
the CRUD methods and other user-related operations in this interface.- Author:
- Joshua M.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createUser
(User user) Creates a new User in the database.void
deleteUser
(User user) Deletes a User from the database.Retrieves all Users from the database.getUser
(int id) Retrieves a User from the database by their ID.Retrieves a User from the database by their username.void
updateUser
(User user) Updates an existing User in the database.
-
Method Details
-
createUser
Creates a new User in the database.- Parameters:
user
- The User to create.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
updateUser
Updates an existing User in the database.- Parameters:
user
- The User with updated information.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
deleteUser
Deletes a User from the database.- Parameters:
user
- The User to delete.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
getUser
Retrieves a User from the database by their ID.- Parameters:
id
- The ID of the User to retrieve.- Returns:
- The
User
matching the ID, or null if not found. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getUser
Retrieves a User from the database by their username.- Parameters:
username
- The username of the User to retrieve.- Returns:
- The
User
matching the username, or null if not found. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getAllUsers
Retrieves all Users from the database.- Returns:
- A list of all
User
objects in the database. - Throws:
SQLException
- If an SQL error occurs during the operation.
-