Interface RoleRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Role,,Integer> org.springframework.data.jpa.repository.JpaRepository<Role,,Integer> org.springframework.data.repository.ListCrudRepository<Role,,Integer> org.springframework.data.repository.ListPagingAndSortingRepository<Role,,Integer> org.springframework.data.repository.PagingAndSortingRepository<Role,,Integer> org.springframework.data.repository.query.QueryByExampleExecutor<Role>,org.springframework.data.repository.Repository<Role,Integer>
@Repository
public interface RoleRepository
extends org.springframework.data.jpa.repository.JpaRepository<Role,Integer>
Repository per la gestione della persistenza dei ruoli utente.
Questa interfaccia permette di interagire con la tabella dei ruoli nel
database,
fornendo meccanismi per recuperare le definizioni dei ruoli (es. ADMIN,
PRODUTTORE)
necessarie per la gestione dei permessi e delle autorizzazioni.
-
Method Summary
Modifier and TypeMethodDescriptionfindByName(ERole name) Recupera un'entita' Ruolo basandosi sul suo nome enumerato.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByName
Recupera un'entita' Ruolo basandosi sul suo nome enumerato. Questo metodo e' fondamentale durante la registrazione o l'assegnazione dei permessi, permettendo di convertire un valore dell'enum ERole nella corrispondente entita' persistente da associare all'utente.- Parameters:
name- Il valore dell'enum che identifica il ruolo cercato.- Returns:
- Un Optional contenente il Ruolo se esiste nel database, altrimenti vuoto.
-