Class PlaceDAO
java.lang.Object
com.JesacaLin.GrubGoblin_v13.daos.PlaceDAO
DAO class for managing Place entities in the database.
-
Constructor Summary
ConstructorsConstructorDescriptionPlaceDAO
(DataSource dataSource) Constructs a new PlaceDAO with the given DataSource. -
Method Summary
Modifier and TypeMethodDescriptioncreatePlace
(Place place) Creates a new Place.int
deletePlaceById
(int placeId) Deletes a Place by its ID.Retrieves all Places.getPlaceById
(int id) Retrieves a Place by its ID.updatePlace
(int id, Place place) Updates a Place.
-
Constructor Details
-
PlaceDAO
Constructs a new PlaceDAO with the given DataSource.- Parameters:
dataSource
- the DataSource to use for database access
-
-
Method Details
-
getPlaceById
Retrieves a Place by its ID.- Parameters:
id
- the ID of the Place to retrieve- Returns:
- the Place with the given ID, or null if no such Place exists
- Throws:
DaoException
- if a database access error occurs
-
getAllPlaces
Retrieves all Places.- Returns:
- a list of all Places
- Throws:
DaoException
- if a database access error occurs
-
createPlace
Creates a new Place.- Parameters:
place
- the Place to create- Returns:
- the created Place
- Throws:
DaoException
- if a database access error occurs or if the Place data violates database constraints
-
updatePlace
Updates a Place.- Parameters:
id
- the ID of the Place to updateplace
- the Place data to update- Returns:
- the updated Place
- Throws:
DaoException
- if a database access error occurs, if the Place data violates database constraints, or if no rows were affected by the update
-
deletePlaceById
public int deletePlaceById(int placeId) Deletes a Place by its ID.- Parameters:
placeId
- the ID of the Place to delete- Returns:
- the number of rows affected by the delete
- Throws:
DaoException
- if a database access error occurs or if the Place data violates database constraints
-