Interface TodoRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Todo,Long>, org.springframework.data.repository.Repository<Todo,Long>

@Repository public interface TodoRepository extends org.springframework.data.repository.CrudRepository<Todo,Long>
The TodoRepository is a repository for Todo entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    This method returns all Todo entities with a given user_id.
    findByIdAndUser(long id, User user)
    This method returns a Todo entity with a given id and user.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
  • Method Details

    • findByIdAndUser

      Optional<Todo> findByIdAndUser(long id, User user)
      This method returns a Todo entity with a given id and user.
      Parameters:
      id - id of the todo
      user - user of the todo
      Returns:
      Optional of Todo (empty if not found)
    • findAllByUserId

      Iterable<Todo> findAllByUserId(Long user_id)
      This method returns all Todo entities with a given user_id.
      Parameters:
      user_id - id of the user
      Returns:
      all Todo entities with a given user_id