Class TutorRepositoryImpl
java.lang.Object
org.example.crmedu.infrastructure.repository.tutor.TutorRepositoryImpl
- All Implemented Interfaces:
TutorRepository
Implementation of the
TutorRepository
interface using JPA. Provides methods for managing Tutor
entities in the database.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes a tutor by its unique identifier.boolean
existsByUser
(Tutor tutor) Checks whether a tutor with the same user already exists.findAll
(int pageNumber, int pageSize) Retrieves a paginated list of tutors.Retrieves a tutor by its unique identifier.Saves a new tutor or updates an existing one.void
Updates an existing tutor.
-
Constructor Details
-
TutorRepositoryImpl
public TutorRepositoryImpl()
-
-
Method Details
-
save
Description copied from interface:TutorRepository
Saves a new tutor or updates an existing one.- Specified by:
save
in interfaceTutorRepository
- Parameters:
tutor
- the tutor to save- Returns:
- the saved
Tutor
entity
-
findById
Description copied from interface:TutorRepository
Retrieves a tutor by its unique identifier.- Specified by:
findById
in interfaceTutorRepository
- Parameters:
id
- the unique identifier of the tutor- Returns:
- an
Optional
containing the tutor if found, otherwise empty
-
findAll
Description copied from interface:TutorRepository
Retrieves a paginated list of tutors.- Specified by:
findAll
in interfaceTutorRepository
- Parameters:
pageNumber
- the page number (starting from 0)pageSize
- the number of tutors per page- Returns:
- a
Page
containing the requested tutors
-
existsByUser
Description copied from interface:TutorRepository
Checks whether a tutor with the same user already exists.- Specified by:
existsByUser
in interfaceTutorRepository
- Parameters:
tutor
- the tutor to check- Returns:
true
if a tutor with the same user exists, otherwisefalse
-
update
Description copied from interface:TutorRepository
Updates an existing tutor.- Specified by:
update
in interfaceTutorRepository
- Parameters:
tutor
- the tutor entity with updated information
-
delete
Description copied from interface:TutorRepository
Deletes a tutor by its unique identifier.- Specified by:
delete
in interfaceTutorRepository
- Parameters:
id
- the unique identifier of the tutor to delete
-