sql -> hql
This commit is contained in:
parent
5b0da1c280
commit
bf5b78c3b6
@ -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);
|
||||||
}
|
}
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
@ -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);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user