Class TutorRepositoryImpl

java.lang.Object
org.example.crmedu.infrastructure.repository.tutor.TutorRepositoryImpl
All Implemented Interfaces:
TutorRepository

@Component public class TutorRepositoryImpl extends Object implements TutorRepository
Implementation of the TutorRepository interface using JPA. Provides methods for managing Tutor entities in the database.
  • Constructor Details

    • TutorRepositoryImpl

      public TutorRepositoryImpl()
  • Method Details

    • save

      public Tutor save(Tutor tutor)
      Description copied from interface: TutorRepository
      Saves a new tutor or updates an existing one.
      Specified by:
      save in interface TutorRepository
      Parameters:
      tutor - the tutor to save
      Returns:
      the saved Tutor entity
    • findById

      public Optional<Tutor> findById(Long id)
      Description copied from interface: TutorRepository
      Retrieves a tutor by its unique identifier.
      Specified by:
      findById in interface TutorRepository
      Parameters:
      id - the unique identifier of the tutor
      Returns:
      an Optional containing the tutor if found, otherwise empty
    • findAll

      public Page<Tutor> findAll(int pageNumber, int pageSize)
      Description copied from interface: TutorRepository
      Retrieves a paginated list of tutors.
      Specified by:
      findAll in interface TutorRepository
      Parameters:
      pageNumber - the page number (starting from 0)
      pageSize - the number of tutors per page
      Returns:
      a Page containing the requested tutors
    • existsByUser

      public boolean existsByUser(Tutor tutor)
      Description copied from interface: TutorRepository
      Checks whether a tutor with the same user already exists.
      Specified by:
      existsByUser in interface TutorRepository
      Parameters:
      tutor - the tutor to check
      Returns:
      true if a tutor with the same user exists, otherwise false
    • update

      public void update(Tutor tutor)
      Description copied from interface: TutorRepository
      Updates an existing tutor.
      Specified by:
      update in interface TutorRepository
      Parameters:
      tutor - the tutor entity with updated information
    • delete

      public void delete(Long id)
      Description copied from interface: TutorRepository
      Deletes a tutor by its unique identifier.
      Specified by:
      delete in interface TutorRepository
      Parameters:
      id - the unique identifier of the tutor to delete