001package edu.pdx.cs.joy.family; 002 003import java.sql.Connection; 004import java.sql.SQLException; 005import java.util.List; 006 007/** 008 * Data Access Object interface for managing Marriage entities in the database. 009 */ 010public interface MarriageDAO { 011 012 /** 013 * Drops the marriages table from the database if it exists. 014 * 015 * @param connection the database connection to use 016 * @throws SQLException if a database error occurs 017 */ 018 static void dropTable(Connection connection) throws SQLException { 019 MarriageDAOImpl.dropTable(connection); 020 } 021 022 /** 023 * Creates the marriages table in the database. 024 * 025 * @param connection the database connection to use 026 * @throws SQLException if a database error occurs 027 */ 028 static void createTable(Connection connection) throws SQLException { 029 MarriageDAOImpl.createTable(connection); 030 } 031 032 /** 033 * Saves a marriage to the database. 034 * 035 * @param marriage the marriage to save 036 * @throws SQLException if a database error occurs 037 */ 038 void save(Marriage marriage) throws SQLException; 039 040 /** 041 * Finds all marriages for a specific person ID. 042 * 043 * @param personId the person ID 044 * @return a list of marriages involving the person 045 * @throws SQLException if a database error occurs 046 */ 047 List<Marriage> findByPersonId(int personId) throws SQLException; 048 049 /** 050 * Finds all marriages in the database. 051 * 052 * @return a list of all marriages 053 * @throws SQLException if a database error occurs 054 */ 055 List<Marriage> findAll() throws SQLException; 056 057 /** 058 * Deletes a marriage from the database. 059 * 060 * @param husbandId the husband's ID 061 * @param wifeId the wife's ID 062 * @throws SQLException if a database error occurs 063 */ 064 void delete(int husbandId, int wifeId) throws SQLException; 065} 066