Interface SubjectRepository
- All Known Implementing Classes:
SubjectRepositoryImpl
public interface SubjectRepository
Repository interface for managing
Subject
entities. Defines methods for CRUD operations and querying subjects.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes a subject by its unique identifier.boolean
existsByNameAndOrganizationId
(Subject subject) Checks whether a subject with the same name that belongs to certain organization already exists.findAll
(int pageNumber, int pageSize) Retrieves a paginated list of subjects.Retrieves a subject by its unique identifierSaves a new subject or updates an existing one.void
Updates an existing subject.
-
Method Details
-
save
Saves a new subject or updates an existing one.- Parameters:
subject
- the subject to save- Returns:
- the saved
Subject
entity
-
findById
Retrieves a subject by its unique identifier- Parameters:
id
- the unique identifier of the subject- Returns:
- an
Optional
containing the subject if found, otherwise empty
-
existsByNameAndOrganizationId
Checks whether a subject with the same name that belongs to certain organization already exists.- Parameters:
subject
- the subject to check- Returns:
true
if a subject with the same name exists, otherwisefalse
-
findAll
Retrieves a paginated list of subjects.- Parameters:
pageNumber
- the page number (starting from 0)pageSize
- the number of subjects per page- Returns:
- a
Page
containing the requested subjects
-
update
Updates an existing subject.- Parameters:
subject
- the subject entity with updated information
-
delete
Deletes a subject by its unique identifier.- Parameters:
id
- the unique identifier of the subject to delete
-