@Query(value = "SELECT Max(id_horario) FROM Horario")
Integer findByHorario_IdHorario();
@Query(value = "SELECT h FROM Horario h where h.estado_registro='PENDIENTE'")
List<Horario> findByEstado();
@Query(value = "SELECT h FROM Horario h where h.estado_registro='COMPLETADO'")
List<Horario> findByEstadoCompletado();
@Query("SELECT h.curso.nombre_curso, count(h.curso.nombre_curso) as ranking FROM Horario h GROUP BY h.curso.nombre_curso order by ranking DESC")
List<Object[]> findByCursoMasSolicitado();
@Query("SELECT h.alumno.nombres, count(h.alumno.nombres) as ranking FROM Horario h GROUP BY h.alumno.nombres order by ranking DESC")
List<Object[]> findByAlumnoQueGeneraMasSolicitudes();
Last active
November 29, 2020 04:34
-
-
Save KeyCuevasMelgarejo/9c0bf9e5f939358991f369435064ca3d to your computer and use it in GitHub Desktop.
Spring | Repository | JPA@query
Claro.
Igual chequea la documentación oficial, hay cosas interesantes, incluso es posible que no necesites utilizar @query y solo utilizar las funciones que el mismo JPA prepara a través de tus entities creadas.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Buen datos key, ayuda para futuros proyectos