mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 08:58:48 +00:00
falta borrar y busqueda por columnas
This commit is contained in:
@ -2,6 +2,9 @@ package com.imprimelibros.erp.users;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@ -14,7 +17,7 @@ public class RoleDaoImpl implements RoleDao {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Role findRoleByName(String theRoleName) {
|
||||
public Optional<Role> findRoleByName(String theRoleName) {
|
||||
|
||||
// retrieve/read from database using name
|
||||
TypedQuery<Role> theQuery = entityManager.createQuery("from Role where name=:roleName", Role.class);
|
||||
@ -27,7 +30,6 @@ public class RoleDaoImpl implements RoleDao {
|
||||
} catch (Exception e) {
|
||||
theRole = null;
|
||||
}
|
||||
|
||||
return theRole;
|
||||
return Optional.ofNullable(theRole);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user