Interface DAO<T>

All Known Implementing Classes:
BanDAO, ImageDAO, InterestDAO, Meeter_InterestDAO, MeeterDAO, MessageDAO, RatingDAO, ReportDAO

public interface DAO<T>
It contains all the methods that should be implemented by the DAOs.
  • Field Details

  • Method Details

    • doRetrieveByCondition

      List<T> doRetrieveByCondition(String condition) throws SQLException
      Returns a list of objects from the database that match a given condition.
      Parameters:
      condition - the condition to be matched.
      Returns:
      the query results as a list of objects.
      Throws:
      SQLException
    • doRetrieveByCondition

      List<T> doRetrieveByCondition(String condition, int row_count) throws SQLException
      Returns a list of objects from the database that match a given condition.
      Parameters:
      condition - the condition to be matched.
      row_count - the number of rows to return.
      Returns:
      the query results as a list of objects.
      Throws:
      SQLException
    • doRetrieveByCondition

      List<T> doRetrieveByCondition(String condition, int offset, int row_count) throws SQLException
      Returns a list of objects from the database that match a given condition.
      Parameters:
      condition - the condition to be matched.
      offset - the offset position.
      row_count - the number of rows to return.
      Returns:
      the query results as a list of objects.
      Throws:
      SQLException
    • doRetrieveByKey

      T doRetrieveByKey(String key) throws SQLException, InvalidPrimaryKeyException
      Returns an object from the database that match a given key.
      Parameters:
      key - the primary key of the object to be retrieved.
      Returns:
      the query result as a single object
      Throws:
      SQLException
      InvalidPrimaryKeyException
    • doRetrieveAll

      List<T> doRetrieveAll() throws SQLException
      Returns a list of all objects from the database.
      Returns:
      the query results as a list of objects.
      Throws:
      SQLException
    • doRetrieveAll

      List<T> doRetrieveAll(int row_count) throws SQLException
      Returns a list of objects from the database, limiting the result set to the specified number of rows.
      Parameters:
      row_count - the number of rows to be returned.
      Returns:
      the query results as a list of objects.
      Throws:
      SQLException
    • doRetrieveAll

      List<T> doRetrieveAll(int offset, int row_count) throws SQLException
      Returns a list of objects from the database, starting at a specified offset and limiting the result set to the specified number of rows.
      Parameters:
      offset - the offset to start the query from.
      row_count - the number of rows to be returned.
      Returns:
      the query results as a list of objects.
      Throws:
      SQLException
    • doSave

      boolean doSave(T obj) throws SQLException
      Saves an object in the database.
      Parameters:
      obj - the object to be saved.
      Returns:
      a boolean value that indicates if the operation was successful or not.
      Throws:
      SQLException
    • doSave

      boolean doSave(HashMap<String,?> values) throws SQLException
      Saves an object in the database populating only the fields contained in values.
      Parameters:
      values - the values to be updated.
      Returns:
      a boolean value that indicates if the operation was successful or not.
      Throws:
      SQLException
    • doUpdate

      boolean doUpdate(HashMap<String,?> values, String condition) throws SQLException
      Updates database objects that match a given condition, using only the values contained in the HashMap
      Parameters:
      values - the values to be updated.
      condition - the condition to be matched.
      Returns:
      a boolean value that indicates if the operation was successful or not.
      Throws:
      SQLException
    • doSaveOrUpdate

      boolean doSaveOrUpdate(T obj) throws SQLException
      Saves an object to the database if it does not already exist, or updates it if it does.
      Parameters:
      obj - the object to be saved or updated.
      Returns:
      a boolean value that indicates if the operation was successful or not.
      Throws:
      SQLException
    • doDelete

      boolean doDelete(String condition) throws SQLException
      Deletes objects from the database that match a given condition.
      Parameters:
      condition - the condition to be matched.
      Returns:
      a boolean value that indicates if the operation was successful or not.
      Throws:
      SQLException