Merge pull request 'sql -> hql' (#6) from hql into master

Reviewed-on: http://git.plannaplan.pl/filipizydorczyk/backend/pulls/6
This commit is contained in:
Marcin Woźniak 2020-09-03 15:27:37 +02:00
commit b65c56078b
3 changed files with 4 additions and 4 deletions

View File

@ -9,6 +9,6 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface CourseRepository extends JpaRepository<Course, Long> { public interface CourseRepository extends JpaRepository<Course, Long> {
@Query(value = "SELECT * FROM course WHERE name = :name", nativeQuery = true) @Query("FROM Course WHERE name = ?1")
Course findByName(@Param("name") String name); Course findByName(@Param("name") String name);
} }

View File

@ -11,10 +11,10 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface GroupRepository extends JpaRepository<Groups, Long> { public interface GroupRepository extends JpaRepository<Groups, Long> {
@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); 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<Groups> getByCourse(@Param("id") Long id); List<Groups> getByCourse(@Param("id") Long id);
} }

View File

@ -9,6 +9,6 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface LecturerRepository extends JpaRepository<Lecturer, Long> { public interface LecturerRepository extends JpaRepository<Lecturer, Long> {
@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); Lecturer find(@Param("title") String title, @Param("name") String name, @Param("surname") String surname);
} }