From bf5b78c3b60b016527fdc7b8c0182dfdf2cc7388 Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Wed, 2 Sep 2020 16:56:49 +0200 Subject: [PATCH] sql -> hql --- .../java/com/plannaplan/repositories/CourseRepository.java | 2 +- .../java/com/plannaplan/repositories/GroupRepository.java | 4 ++-- .../java/com/plannaplan/repositories/LecturerRepository.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/buisnesslogic/src/main/java/com/plannaplan/repositories/CourseRepository.java b/buisnesslogic/src/main/java/com/plannaplan/repositories/CourseRepository.java index 55227a1..0bc99eb 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/repositories/CourseRepository.java +++ b/buisnesslogic/src/main/java/com/plannaplan/repositories/CourseRepository.java @@ -9,6 +9,6 @@ import org.springframework.stereotype.Repository; @Repository public interface CourseRepository extends JpaRepository { - @Query(value = "SELECT * FROM course WHERE name = :name", nativeQuery = true) + @Query("FROM Course WHERE name = ?1") Course findByName(@Param("name") String name); } \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/repositories/GroupRepository.java b/buisnesslogic/src/main/java/com/plannaplan/repositories/GroupRepository.java index 08e607d..582b16f 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/repositories/GroupRepository.java +++ b/buisnesslogic/src/main/java/com/plannaplan/repositories/GroupRepository.java @@ -11,10 +11,10 @@ import org.springframework.stereotype.Repository; @Repository public interface GroupRepository extends JpaRepository { - @Query(value = "SELECT * FROM groups WHERE time = :time AND room = :room AND capacity = :capacity ", nativeQuery = true) + @Query("FROM Groups WHERE time = ?1 AND room = ?2 AND capacity = ?3") Groups find(@Param("time") int time, @Param("room") String room, @Param("capacity") int capacity); - @Query(value = "SELECT * FROM groups WHERE course_id = :id", nativeQuery = true) + @Query("FROM Groups WHERE course_id = ?1") List getByCourse(@Param("id") Long id); } \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java b/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java index 7f0516b..1115ea9 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java +++ b/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java @@ -9,6 +9,6 @@ import org.springframework.stereotype.Repository; @Repository public interface LecturerRepository extends JpaRepository { - @Query(value = "SELECT * FROM lecturer WHERE name = :name AND surname = :surname AND title = :title ", nativeQuery = true) + @Query("FROM Lecturer WHERE title = ?1 AND name = ?2 AND surname = ?3") Lecturer find(@Param("title") String title, @Param("name") String name, @Param("surname") String surname); } \ No newline at end of file