23 lines
678 B
Java
Executable File
23 lines
678 B
Java
Executable File
package com.plannaplan.repositories;
|
|
|
|
import java.util.Optional;
|
|
|
|
import com.plannaplan.entities.Course;
|
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.data.repository.query.Param;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
/**
|
|
* CourseRepository.findByName:
|
|
* Return list of:
|
|
* SELECT * FROM Course WHERE name = i .
|
|
*
|
|
* Where i, ?1 are equale to variables.
|
|
*/
|
|
@Repository
|
|
public interface CourseRepository extends JpaRepository<Course, Long> {
|
|
@Query("FROM Course WHERE name = ?1")
|
|
Optional<Course> findByName(@Param("name") String name);
|
|
} |