Last active
January 7, 2018 17:22
-
-
Save finsterthecat/0d1f3af46e3c2a1c295941ff6f8939dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.navan.heroesbackend; | |
import org.springframework.data.jpa.repository.Query; | |
import org.springframework.data.repository.CrudRepository; | |
import org.springframework.data.repository.query.Param; | |
import org.springframework.data.rest.core.annotation.RestResource; | |
public interface HeroRepository extends CrudRepository<Hero, Long> { | |
@RestResource(path = "name", rel="name") | |
@Query("from Hero h where lower(h.name) like CONCAT('%', lower(:contains), '%')") | |
public Iterable<Hero> findByName(@Param("contains") String name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment