Package edu.pdx.cs.joy.family
Interface MarriageDAO
- All Known Implementing Classes:
MarriageDAOImpl
public interface MarriageDAO
Data Access Object interface for managing Marriage entities in the database.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateTable(Connection connection) Creates the marriages table in the database.voiddelete(int husbandId, int wifeId) Deletes a marriage from the database.static voiddropTable(Connection connection) Drops the marriages table from the database if it exists.findAll()Finds all marriages in the database.findByPersonId(int personId) Finds all marriages for a specific person ID.voidSaves a marriage to the database.
-
Method Details
-
dropTable
Drops the marriages table from the database if it exists.- Parameters:
connection- the database connection to use- Throws:
SQLException- if a database error occurs
-
createTable
Creates the marriages table in the database.- Parameters:
connection- the database connection to use- Throws:
SQLException- if a database error occurs
-
save
Saves a marriage to the database.- Parameters:
marriage- the marriage to save- Throws:
SQLException- if a database error occurs
-
findByPersonId
Finds all marriages for a specific person ID.- Parameters:
personId- the person ID- Returns:
- a list of marriages involving the person
- Throws:
SQLException- if a database error occurs
-
findAll
Finds all marriages in the database.- Returns:
- a list of all marriages
- Throws:
SQLException- if a database error occurs
-
delete
Deletes a marriage from the database.- Parameters:
husbandId- the husband's IDwifeId- the wife's ID- Throws:
SQLException- if a database error occurs
-