This commit is contained in:
2018-12-26 16:21:14 +01:00
parent 91d12ae6d4
commit 0ad276646a

View File

@@ -2,9 +2,17 @@ package me.aski.prepactrlws.repositories;
import me.aski.prepactrlws.entities.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import java.util.List;
@RepositoryRestResource
public interface StudentRepository extends JpaRepository<Student, Long> {
@Query("select s from Student s where s.lastName like CONCAT('%',:name,'%')")
List<Student> searchByLastName(@Param("name") String name);
List<Student> findByLastNameContaining(@Param("name") String name);
}