diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java index 3049fb8e29fd37eea96854b2702d89c7c6d948cc..e4c222b65a4f6ea2493a9f50aa252be7f8ce18b3 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java @@ -45,7 +45,7 @@ public class JpaVetRepositoryImpl implements VetRepository { @Cacheable(value = "vets") @SuppressWarnings("unchecked") public Collection<Vet> findAll() { - return this.em.createQuery("SELECT vet FROM Vet vet join fetch vet.specialties ORDER BY vet.lastName, vet.firstName").getResultList(); + return this.em.createQuery("SELECT distinct vet FROM Vet vet left join fetch vet.specialties ORDER BY vet.lastName, vet.firstName").getResultList(); } }