Skip to content

Instantly share code, notes, and snippets.

@evonsdesigns
Created May 22, 2018 16:29
Show Gist options
  • Select an option

  • Save evonsdesigns/3a1c20cf4d0b931412b8a555e120f796 to your computer and use it in GitHub Desktop.

Select an option

Save evonsdesigns/3a1c20cf4d0b931412b8a555e120f796 to your computer and use it in GitHub Desktop.
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {
@Query( value = "select * from person p " +
"join person_addresses b " +
" on p.id = b.person_id " +
"join address c " +
" on c.id = b.addresses_id " +
"where c.zip = :zip", nativeQuery = true)
Iterable<Person> getPeopleWithZip(@Param("zip") String zip);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment