Interface IGenericDAO<T,ID>

Type Parameters:
T - The type of entity.
ID - The type of the entity's identifier.
All Known Subinterfaces:
IAdvertiserDAO, IPermissionDAO, IProfileDAO, IRoleDAO, IUserDAO
All Known Implementing Classes:
AdvertiserDAOImpl, GenericDAOImpl, PermissionDAOImpl, ProfileDAOImpl, RoleDAOImpl, UserDAOImpl

public interface IGenericDAO<T,ID>
Generic Data Access Object (DAO) interface providing common CRUD operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes an entity by its identifier - must not be null.
    boolean
    Checks if multiple entities exist by their identifiers.
    boolean
    Checks if an entity exists by its identifier.
    boolean
    Checks if an entity exists based on its unique properties.
    Retrieves all entities.
    Finds all entities by their identifiers.
    org.springframework.data.domain.Page<T>
    findAllPage(org.springframework.data.domain.Pageable pageable)
    Retrieves all entities with pagination support.
    Finds an entity by its identifier.
    save(T t)
    Saves a new entity.
    Saves multiple entities in batch.
    updateById(T t, ID id)
    Updates an entity by its identifier.
  • Method Details

    • findById

      Optional<T> findById(ID id)
      Finds an entity by its identifier.
      Parameters:
      id - The identifier of the entity - must not be null.
      Returns:
      An Optional containing the entity if found, otherwise empty.
    • findAllByIds

      List<T> findAllByIds(Collection<ID> ids)
      Finds all entities by their identifiers.
      Parameters:
      ids - A collection of entity identifiers - must not be null.
      Returns:
      A list of entities found.
    • updateById

      T updateById(T t, ID id)
      Updates an entity by its identifier.
      Parameters:
      t - The updated entity data - must not be null.
      id - The identifier of the entity to update - must not be null.
      Returns:
      The updated entity.
    • save

      T save(T t)
      Saves a new entity.
      Parameters:
      t - The entity to save - must not be null.
      Returns:
      The saved entity.
    • saveAll

      List<T> saveAll(Collection<T> t)
      Saves multiple entities in batch.
      Parameters:
      t - A collection of entities to save - must not be null.
      Returns:
      A list of saved entities.
    • deleteById

      void deleteById(ID id)
      Deletes an entity by its identifier - must not be null.
      Parameters:
      id - The identifier of the entity to delete.
    • findAll

      List<T> findAll()
      Retrieves all entities.
      Returns:
      A list of all entities.
    • findAllPage

      org.springframework.data.domain.Page<T> findAllPage(org.springframework.data.domain.Pageable pageable)
      Retrieves all entities with pagination support.
      Parameters:
      pageable - The pagination configuration - must not be null.
      Returns:
      A Page containing the paginated entities.
    • existsById

      boolean existsById(ID id)
      Checks if an entity exists by its identifier.
      Parameters:
      id - The identifier of the entity - must not be null.
      Returns:
      true if the entity exists, otherwise false.
    • existsAllByIds

      boolean existsAllByIds(Collection<ID> ids)
      Checks if multiple entities exist by their identifiers.
      Parameters:
      ids - A collection of entity identifiers - must not be null.
      Returns:
      true if all entities exist, otherwise false.
    • existsByUniqueProperties

      boolean existsByUniqueProperties(T t)
      Checks if an entity exists based on its unique properties.
      Parameters:
      t - The entity containing unique properties to check - must not be null.
      Returns:
      true if an entity with the same unique properties exists, otherwise false.