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 Type
    Method
    Description
    static void
    createTable(Connection connection)
    Creates the marriages table in the database.
    void
    delete(int husbandId, int wifeId)
    Deletes a marriage from the database.
    static void
    dropTable(Connection connection)
    Drops the marriages table from the database if it exists.
    Finds all marriages in the database.
    findByPersonId(int personId)
    Finds all marriages for a specific person ID.
    void
    save(Marriage marriage)
    Saves a marriage to the database.
  • Method Details

    • dropTable

      static void dropTable(Connection connection) throws SQLException
      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

      static void createTable(Connection connection) throws SQLException
      Creates the marriages table in the database.
      Parameters:
      connection - the database connection to use
      Throws:
      SQLException - if a database error occurs
    • save

      void save(Marriage marriage) throws SQLException
      Saves a marriage to the database.
      Parameters:
      marriage - the marriage to save
      Throws:
      SQLException - if a database error occurs
    • findByPersonId

      List<Marriage> findByPersonId(int personId) throws SQLException
      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

      void delete(int husbandId, int wifeId) throws SQLException
      Deletes a marriage from the database.
      Parameters:
      husbandId - the husband's ID
      wifeId - the wife's ID
      Throws:
      SQLException - if a database error occurs