Class ChallengeDao

java.lang.Object
me.nickhanson.codeforge.persistence.ChallengeDao

public class ChallengeDao extends Object
Data Access Object (DAO) for the Challenge entity. Provides methods to perform CRUD operations and custom queries on Challenge entities.
Author:
Nick Hanson
  • Constructor Details

    • ChallengeDao

      public ChallengeDao()
  • Method Details

    • getById

      public Challenge getById(Long id)
    • getAll

      public List<Challenge> getAll()
    • saveOrUpdate

      public void saveOrUpdate(Challenge challenge)
    • delete

      public void delete(Challenge challenge)
    • findByTitle

      public List<Challenge> findByTitle(String title)
      Finds challenges by their title.
      Parameters:
      title - The title of the challenge to search for.
      Returns:
      A list of challenges matching the given title.
    • findByDifficulty

      public List<Challenge> findByDifficulty(Difficulty difficulty)
      Finds challenges by their difficulty level.
      Parameters:
      difficulty - The difficulty level to search for.
      Returns:
      A list of challenges matching the given difficulty level.
    • existsTitleIgnoreCase

      public boolean existsTitleIgnoreCase(String title)
      Checks if a challenge with the given title exists, ignoring case.
      Parameters:
      title - The title to check for existence.
      Returns:
      True if a challenge with the given title exists, false otherwise.
    • existsTitleForOtherIgnoreCase

      public boolean existsTitleForOtherIgnoreCase(String title, Long excludeId)
      Checks if a challenge with the given title exists, ignoring case, excluding a specific challenge by its ID.
      Parameters:
      title - The title to check for existence.
      excludeId - The ID of the challenge to exclude from the check.
      Returns:
      True if a challenge with the given title exists (excluding the specified ID), false otherwise.