Commit 6836f43d by Rubén Ramírez

feat: [RepositorioRecurso]: Implementadas las funciones para las búsquedas por…

feat: [RepositorioRecurso]: Implementadas las funciones para las búsquedas por id y borrar el recurso en el repositorio
parent b1fba10b
......@@ -21,6 +21,11 @@ public class RepositorioRecurso {
}
@Transactional(readOnly = true)
public Recurso buscarPorId(Long id) {
return em.find(Recurso.class, id);
}
@Transactional(readOnly = true)
public List<Recurso> buscarPorTitulo(String titulo) {
return em.createQuery(
"SELECT r FROM Recurso r WHERE LOWER(TRANSLATE(r.titulo, 'ÁÉÍÓÚáéíóú', 'AEIOUaeiou')) " +
......@@ -62,4 +67,11 @@ public class RepositorioRecurso {
return em.merge(recurso);
}
@Transactional
public void borrarRecurso(Recurso recurso) {
recurso = em.merge(recurso); // Asegurar que el objeto está en estado "managed"
em.remove(recurso);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment